Commit 31226b61 authored by Craig Silverstein's avatar Craig Silverstein

* Get rid of unnecessary c++ aliasing violation (csilvers)

	* Better error message on parse failure (tstromberg)


git-svn-id: https://gflags.googlecode.com/svn/trunk@37 6586e3c6-dcc4-952a-343f-ff74eb82781d
parent 31c8edc5
......@@ -523,13 +523,13 @@ bool IsBoolFlag(bool from);
#define DEFINE_string(name, val, txt) \
namespace fLS { \
static union { void* align; char s[sizeof(std::string)]; } s_##name[2]; \
const std::string* const FLAGS_no##name = new (s_##name[0].s) std::string(val); \
std::string* const FLAGS_no##name = new (s_##name[0].s) std::string(val); \
static @ac_google_namespace@::FlagRegisterer o_##name( \
#name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__, \
s_##name[0].s, new (s_##name[1].s) std::string(*FLAGS_no##name)); \
extern std::string& FLAGS_##name; \
using fLS::FLAGS_##name; \
std::string& FLAGS_##name = *(reinterpret_cast<std::string*>(s_##name[0].s)); \
std::string& FLAGS_##name = *FLAGS_no##name; \
} \
using fLS::FLAGS_##name
......
......@@ -534,13 +534,13 @@ GFLAGS_DLL_DECL bool IsBoolFlag(bool from);
#define DEFINE_string(name, val, txt) \
namespace fLS { \
static union { void* align; char s[sizeof(std::string)]; } s_##name[2]; \
const std::string* const FLAGS_no##name = new (s_##name[0].s) std::string(val); \
std::string* const FLAGS_no##name = new (s_##name[0].s) std::string(val); \
static ::google::FlagRegisterer o_##name( \
#name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__, \
s_##name[0].s, new (s_##name[1].s) std::string(*FLAGS_no##name)); \
extern __declspec(dllexport) std::string& FLAGS_##name; \
using fLS::FLAGS_##name; \
std::string& FLAGS_##name = *(reinterpret_cast<std::string*>(s_##name[0].s)); \
std::string& FLAGS_##name = *FLAGS_no##name; \
} \
using fLS::FLAGS_##name
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment