This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix warning in tree-diagnostic.h.


On Mon, Nov 02, 2015 at 09:57:22AM -0700, Jeff Law wrote:
> On 11/02/2015 06:26 AM, Dominik Vogt wrote:
> >The attached patch fixes the annoying warnings generated by
> >diagnostic_set_last_function.
> Can you point out what warning you're fixing?

Sure.  toplec.c calls diagnostic_set_last_function with a NULL
pointer as the second argument, and cp/typeck.c complains about
it.  Ah, it seems the *current* version of Gcc does not generate
the warning, but the old one (4.8.5) I used to compile does.  So,
it may or may not be worth to apply the patch.

-- snip --
unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long \
-Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/../include -I../../gcc/../libc\
pp/include -I../../gcc/../libdecnumber -I../../gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/../libbacktrace -o trans-mem.o -MT \
trans-mem.o -MMD -MP -MF ./.deps/trans-mem.TPo ../../gcc/trans-mem.c
In file included from ../../gcc/toplev.c:42:0:
../../gcc/toplev.c: In function â\200\230void announce_function(tree)â\200\231:
../../gcc/diagnostic.h:202:50: warning: invalid access to non-static data member â\200\230diagnostic_info::x_dataâ\200\231 of NULL object \
[-Winvalid-offsetof]
#define diagnostic_info_auxiliary_data(DI) (DI)->x_data
^
../../gcc/tree-diagnostic.h:28:11: note: in expansion of macro â\200\230diagnostic_info_auxiliary_dataâ\200\231
((tree) diagnostic_info_auxiliary_data (DI))
^
../../gcc/tree-diagnostic.h:47:17: note: in expansion of macro â\200\230diagnostic_abstract_originâ\200\231
= (((DI) && diagnostic_abstract_origin (DI)) \
^
../../gcc/toplev.c:233:7: note: in expansion of macro â\200\230diagnostic_set_last_functionâ\200\231
diagnostic_set_last_function (global_dc, (diagnostic_info *) NULL);
^
../../gcc/diagnostic.h:202:50: warning: (perhaps the â\200\230offsetofâ\200\231 macro was used incorrectly) [-Winvalid-offsetof]
#define diagnostic_info_auxiliary_data(DI) (DI)->x_data
^
../../gcc/tree-diagnostic.h:28:11: note: in expansion of macro â\200\230diagnostic_info_auxiliary_dataâ\200\231
((tree) diagnostic_info_auxiliary_data (DI))
^
../../gcc/tree-diagnostic.h:47:17: note: in expansion of macro â\200\230diagnostic_abstract_originâ\200\231
= (((DI) && diagnostic_abstract_origin (DI)) \
^
../../gcc/toplev.c:233:7: note: in expansion of macro â\200\230diagnostic_set_last_functionâ\200\231
diagnostic_set_last_function (global_dc, (diagnostic_info *) NULL);
^
../../gcc/diagnostic.h:202:50: warning: invalid access to non-static data member â\200\230diagnostic_info::x_dataâ\200\231 of NULL object \
[-Winvalid-offsetof]
#define diagnostic_info_auxiliary_data(DI) (DI)->x_data 
-- snip --

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]