GNOME Bugzilla – Bug 726136
use && instead of 'and' in deprecation warnings
Last modified: 2014-03-13 21:25:59 UTC
'and' is a C++ keyword and -Wc++-compat finds it
can you give some examples in gtk headers where this would be relevant ? (asking about headers because I don't really care if gtk+ itself is free of such warnings)
It breaks compilation of _other_ software using -Werror -Wc++-compat, such as Wireshark. Thanks to the presence of this we can't use -Wc++-compat in GTK+ related part.
could you provide some logs that show examples of the breakage, please ?
Created attachment 271606 [details] [review] the patch
that's not what Matthias asked. also, that "and" goes into an attribute text field, not in a compilation unit, so it should never trigger a c++-compat warning. on top of that, the whole header is conditionally dependent on an `extern "C" { }` block. can you please attach a compilation log?
On Debian testing (GTK+ 3.10) $ echo -e '#include <gtk/gtk.h>\nmain(){};' > test.c $ gcc -I $(pkg-config --cflags gtk+-3.0) $(pkg-config --cflags glib-2.0) -Werror -Wc++-compat test.c In file included from /usr/include/gtk-3.0/gtk/gtkapplication.h:27:0, from /usr/include/gtk-3.0/gtk/gtkwindow.h:33, from /usr/include/gtk-3.0/gtk/gtkdialog.h:33, from /usr/include/gtk-3.0/gtk/gtkaboutdialog.h:30, from /usr/include/gtk-3.0/gtk/gtk.h:31, from test.c:1: /usr/include/gtk-3.0/gtk/gtkwidget.h:945:58: error: identifier "and" is a special operator name in C++ [-Werror=c++-compat] GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_get_preferred_width and gtk_widget_get_preferred_height) ^ cc1: all warnings being treated as errors
@Emmanuele: It was clear what Matthias asked, I just noticed that I forgot adding the patch for this second bug report.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40564 seems related
Thank you for fixing that. The fix may also be a good candidate for back-porting to 3.10.x IMHO.