[Bug c/35017] [4.3 Regression] PR11377 pedwarns even about valid code
--- Comment #7 from jakub at gcc dot gnu dot org 2008-01-29 23:22 --- Fixed. -- jakub at gcc dot gnu dot org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35017
[Bug c/35017] [4.3 Regression] PR11377 pedwarns even about valid code
--- Comment #6 from jakub at gcc dot gnu dot org 2008-01-29 23:19 --- Subject: Bug 35017 Author: jakub Date: Tue Jan 29 23:19:07 2008 New Revision: 131945 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131945 Log: PR c/35017 * c-decl.c (start_decl): Don't pedwarn about TREE_READONLY static decls. * c-typeck.c (build_external_ref): Don't pedwarn about static vars in current function's scope. * gcc.dg/inline-25.c: New test. * gcc.dg/inline-26.c: New test. * gcc.dg/inline-27.c: New test. Added: trunk/gcc/testsuite/gcc.dg/inline-25.c trunk/gcc/testsuite/gcc.dg/inline-26.c trunk/gcc/testsuite/gcc.dg/inline-27.c Modified: trunk/gcc/ChangeLog trunk/gcc/c-decl.c trunk/gcc/c-typeck.c trunk/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35017
[Bug c/35017] [4.3 Regression] PR11377 pedwarns even about valid code
--- Comment #5 from joseph at codesourcery dot com 2008-01-29 18:24 --- Subject: Re: [4.3 Regression] PR11377 pedwarns even about valid code On Tue, 29 Jan 2008, jakub at gcc dot gnu dot org wrote: > TREE_READONLY isn't modifiable, so I guess that part is quite clear and I'm > also > pretty sure about the possibility to reference static const vars declared in > the function. > What is more unclear is in what kind of inline functions this should be warned > about. 6.7.4p3 talks about inline definition of a function, is that function > definition with inline keyword in this context (i.e. any non-static inline > function) or is that inline definition in the 6.7.4p6 sense (one where there > is > no external definition)? > The attached patch implements the first choice, leaving the original > conditions > for current_function_decl in both places would keep the second choice. > Joseph? I think it means inline definition as in 6.7.4p6 (where whether it's an inline definition depends on whether there are subsequent declarations after the definition with extern or without inline, but getting the diagnostics right for such cases is a separate bug). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35017
[Bug c/35017] [4.3 Regression] PR11377 pedwarns even about valid code
--- Comment #4 from jakub at gcc dot gnu dot org 2008-01-29 17:48 --- Created an attachment (id=15052) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15052&action=view) gcc43-pr35017.patch Alternative patch, which only pedwarns in inline definitions as defined in 4.7.6p6 as before, just doesn't warn when it should not. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35017
[Bug c/35017] [4.3 Regression] PR11377 pedwarns even about valid code
--- Comment #3 from jakub at gcc dot gnu dot org 2008-01-29 17:39 --- BTW, the patch I've attached doesn't bootstrap, got an error on bitmap.c. Simplified testcase: typedef int bitmap_element; typedef struct { bitmap_element *first; } *bitmap; extern void bitmap_clear (bitmap); static void bitmap_elt_clear_from (bitmap, bitmap_element *); void bitmap_elt_clear_from (bitmap head, bitmap_element *elt) { (void) head; (void) elt; } inline void bitmap_clear (bitmap head) { if (head->first) bitmap_elt_clear_from (head, head->first); } If this is valid ISO C99, then I'll need to adjust the patch. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35017
[Bug c/35017] [4.3 Regression] PR11377 pedwarns even about valid code
--- Comment #2 from jakub at gcc dot gnu dot org 2008-01-29 17:31 --- Created an attachment (id=15051) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15051&action=view) gcc43-pr35017.patch TREE_READONLY isn't modifiable, so I guess that part is quite clear and I'm also pretty sure about the possibility to reference static const vars declared in the function. What is more unclear is in what kind of inline functions this should be warned about. 6.7.4p3 talks about inline definition of a function, is that function definition with inline keyword in this context (i.e. any non-static inline function) or is that inline definition in the 6.7.4p6 sense (one where there is no external definition)? The attached patch implements the first choice, leaving the original conditions for current_function_decl in both places would keep the second choice. Joseph? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35017
[Bug c/35017] [4.3 Regression] PR11377 pedwarns even about valid code
--- Comment #1 from pinskia at gcc dot gnu dot org 2008-01-29 17:07 --- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11377 says otherwise. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35017
[Bug c/35017] [4.3 Regression] PR11377 pedwarns even about valid code
-- jakub at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org |dot org | Status|UNCONFIRMED |ASSIGNED Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2008-01-29 15:54:31 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35017
[Bug c/35017] [4.3 Regression] PR11377 pedwarns even about valid code
-- rguenth at gcc dot gnu dot org changed: What|Removed |Added Keywords||diagnostic, rejects-valid Priority|P3 |P2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35017
[Bug c/35017] [4.3 Regression] PR11377 pedwarns even about valid code
-- jakub at gcc dot gnu dot org changed: What|Removed |Added Target Milestone|--- |4.3.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35017