On 8 July 2013 08:49, Murray Cumming <[email protected]> wrote: > It would be nice to have some general fix for this warning when using > --std=c++11 with g++: > > optiongroup.cc: In member function 'void > Glib::OptionGroup::add_entry(const Glib::OptionEntry&)': > optiongroup.cc:320:3: error: missing initializer for member > '_GOptionEntry::short_name' [-Werror=missing-field-initializers] > optiongroup.cc:320:3: error: missing initializer for member > '_GOptionEntry::flags' [-Werror=missing-field-initializers] > optiongroup.cc:320:3: error: missing initializer for member > '_GOptionEntry::arg' [-Werror=missing-field-initializers] > optiongroup.cc:320:3: error: missing initializer for member > '_GOptionEntry::arg_data' [-Werror=missing-field-initializers] > optiongroup.cc:320:3: error: missing initializer for member > '_GOptionEntry::description' [-Werror=missing-field-initializers] > optiongroup.cc:320:3: error: missing initializer for member > '_GOptionEntry::arg_description' [-Werror=missing-field-initializers] > > It's caused by the GLIBMM_INITIALIZE_STRUCT macro definition using the > second possibility rather than the first, because __STRICT_ANSI__ is not > defined, but I don't know why that would have been defined before, but > not with C++11. > https://git.gnome.org/browse/glibmm/tree/glib/glibmm/utility.h#n28 >
I found http://stackoverflow.com/questions/5580921/how-can-i-make-c0x-and-strict-ansi-get-along. It looks like -- from this and other websites -- that gcc defines __STRICT_ANSI__ if --std=c++11 is defined. With: $ g++ --version g++ (Debian 4.7.3-4) 4.7.3 and: $ touch empty.c $ touch empty.cpp I get: $ gcc -std=c99 -E -dM empty.c | grep -P "(__STRICT|__cplusplus)" #define __STRICT_ANSI__ 1 $ gcc -std=gnu99 -E -dM empty.c | grep -P "(__STRICT|__cplusplus)" $ gcc -std=c++98 -E -dM empty.cpp | grep -P "(__STRICT|__cplusplus)" #define __STRICT_ANSI__ 1 #define __cplusplus 199711L $ gcc -std=gnu++98 -E -dM empty.cpp | grep -P "(__STRICT|__cplusplus)" #define __cplusplus 199711L $ gcc -std=c++11 -E -dM empty.cpp | grep -P "(__STRICT|__cplusplus)" #define __STRICT_ANSI__ 1 #define __cplusplus 201103L $ gcc -std=gnu++11 -E -dM empty.cpp | grep -P "(__STRICT|__cplusplus)" #define __cplusplus 201103L $ gcc -std=c++0x -E -dM empty.cpp | grep -P "(__STRICT|__cplusplus)" #define __STRICT_ANSI__ 1 #define __cplusplus 201103L $ gcc-4.4 -std=c++0x -E -dM empty.cpp | grep -P "(__STRICT|__cplusplus)" #define __STRICT_ANSI__ 1 #define __cplusplus 1 So: __STRICT_ANSI__ checks for ISO/ANSI compliance vs GNU extensions (C or C++). __cplusplus checks for C++ vs C (with 199711L for C++98, 1 for C++0x (pre-standardisation) and 201103L for C++11). HTH, - Reece
_______________________________________________ gtkmm-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/gtkmm-list
