[Bug other/36901] pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors

2008-08-10 Thread manu at gcc dot gnu dot org


--- Comment #12 from manu at gcc dot gnu dot org  2008-08-10 14:48 ---
Closing again.


-- 

manu at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36901



[Bug other/36901] pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors

2008-08-10 Thread eric dot weddington at atmel dot com


--- Comment #13 from eric dot weddington at atmel dot com  2008-08-10 16:50 
---
Manuel,
Note that I have *not committed* your patch to fix this. I don't have
assignment papers done yet, nor do I have commit privs. You'll need to commit
this to fix the problem.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36901



[Bug other/36901] pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors

2008-08-10 Thread manu at gcc dot gnu dot org


--- Comment #14 from manu at gcc dot gnu dot org  2008-08-10 18:34 ---
Subject: Bug 36901

Author: manu
Date: Sun Aug 10 18:32:52 2008
New Revision: 138932

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=138932
Log:
2008-08-10  Manuel Lopez-Ibanez  [EMAIL PROTECTED]

PR 36901
testsuite/
* gcc.dg/pr36901.h: Do not depend on limits.h.
* gcc.dg/pr36901-3.c: Update.
* gcc.dg/pr36901-4.c: Update.

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/pr36901-3.c
trunk/gcc/testsuite/gcc.dg/pr36901-4.c
trunk/gcc/testsuite/gcc.dg/pr36901.h


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36901



[Bug other/36901] pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors

2008-08-09 Thread eric dot weddington at atmel dot com


--- Comment #6 from eric dot weddington at atmel dot com  2008-08-09 17:15 
---
Your fix causes a regression on the AVR:

FAIL: gcc.dg/pr36901-4.c #include_next (test for errors, line )

Success with trunk revision 138883
Failed with trunk revision 138904


-- 

eric dot weddington at atmel dot com changed:

   What|Removed |Added

 CC||eric dot weddington at atmel
   ||dot com
 Status|RESOLVED|UNCONFIRMED
 Resolution|FIXED   |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36901



[Bug other/36901] pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors

2008-08-09 Thread eric dot weddington at atmel dot com


--- Comment #7 from eric dot weddington at atmel dot com  2008-08-09 17:16 
---
*** Bug 37069 has been marked as a duplicate of this bug. ***


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36901



[Bug other/36901] pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors

2008-08-09 Thread manu at gcc dot gnu dot org


--- Comment #8 from manu at gcc dot gnu dot org  2008-08-09 17:30 ---
I don't have AVR so I cannot know what exactly is going on or test a fix.
However, I guess that the limits.h used by AVR do not use #include_next. So you
could try by adding #include_next in pr36901-system.h, that is:

- #include pr36901.h
+ #include_next pr36901.h

Could you test that?


-- 

manu at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||manu at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36901



[Bug other/36901] pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors

2008-08-09 Thread eric dot weddington at atmel dot com


--- Comment #9 from eric dot weddington at atmel dot com  2008-08-09 19:34 
---
You're right in that limits.h for the AVR does not use #include_next. The
limits.h that the AVR toolchain uses is installed by gcc.

Unfortunately your suggestion makes the situation worse. There are now 4
failures instead of one:
FAIL: gcc.dg/pr36901-1.c (test for excess errors)
FAIL: gcc.dg/pr36901-4.c overflow (test for warnings, line )
FAIL: gcc.dg/pr36901-4.c overflow (test for errors, line )
FAIL: gcc.dg/pr36901-4.c (test for excess errors)


Here are the details from the log:
Executing on host: /usr/local/avrdev/gcc/build/gcc/xgcc
-B/usr/local/avrdev/gcc/build/gcc/
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-1.c   -pedantic-errors
-DSTACK_SIZE=2048 -DNO_TRAMPOLINES -fno-show-column -S  -DSIGNAL_SUPPRESS
-mmcu=atmega128   -o pr36901-1.s(timeout = 300)
In file included from
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-1.c:3:
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-system.h:2: error:
pr36901.h: No such file or directory
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-1.c: In function 'foo':
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-1.c:6: error: 'sc'
undeclared (first use in this function)
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-1.c:6: error: (Each
undeclared identifier is reported only once
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-1.c:6: error: for each
function it appears in.)
compiler exited with status 1
output is:
In file included from
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-1.c:3:
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-system.h:2: error:
pr36901.h: No such file or directory
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-1.c: In function 'foo':
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-1.c:6: error: 'sc'
undeclared (first use in this function)
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-1.c:6: error: (Each
undeclared identifier is reported only once
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-1.c:6: error: for each
function it appears in.)

FAIL: gcc.dg/pr36901-1.c (test for excess errors)
Excess errors:
In file included from
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-1.c:3:
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-system.h:2: error:
pr36901.h: No such file or directory
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-1.c:6: error: 'sc'
undeclared (first use in this function)
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-1.c:6: error: (Each
undeclared identifier is reported only once
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-1.c:6: error: for each
function it appears in.)

Executing on host: /usr/local/avrdev/gcc/build/gcc/xgcc
-B/usr/local/avrdev/gcc/build/gcc/
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-2.c   -pedantic-errors
-w -DSTACK_SIZE=2048 -DNO_TRAMPOLINES -fno-show-column -S  -DSIGNAL_SUPPRESS
-mmcu=atmega128   -o pr36901-2.s(timeout = 300)
PASS: gcc.dg/pr36901-2.c (test for excess errors)
Executing on host: /usr/local/avrdev/gcc/build/gcc/xgcc
-B/usr/local/avrdev/gcc/build/gcc/
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-3.c   -pedantic-errors
-DSTACK_SIZE=2048 -DNO_TRAMPOLINES -fno-show-column -S  -DSIGNAL_SUPPRESS
-mmcu=atmega128   -o pr36901-3.s(timeout = 300)
In file included from
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-3.c:3:
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901.h:2: warning: integer
overflow in expression
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901.h:2: error: overflow in
constant expression
compiler exited with status 1
output is:
In file included from
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-3.c:3:
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901.h:2: warning: integer
overflow in expression
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901.h:2: error: overflow in
constant expression

PASS: gcc.dg/pr36901-3.c In file included (test for warnings, line )
PASS: gcc.dg/pr36901-3.c overflow (test for warnings, line )
PASS: gcc.dg/pr36901-3.c overflow (test for errors, line )
PASS: gcc.dg/pr36901-3.c (test for excess errors)
Executing on host: /usr/local/avrdev/gcc/build/gcc/xgcc
-B/usr/local/avrdev/gcc/build/gcc/
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-4.c   -pedantic-errors
-Wsystem-headers -DSTACK_SIZE=2048 -DNO_TRAMPOLINES -fno-show-column -S 
-DSIGNAL_SUPPRESS -mmcu=atmega128   -o pr36901-4.s(timeout = 300)
In file included from
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-4.c:3:
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-system.h:2: error:
#include_next is a GCC extension
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-system.h:2: error:
pr36901.h: No such file or directory
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-4.c: In function 'foo':
/usr/local/avrdev/gcc/gcc/gcc/testsuite/gcc.dg/pr36901-4.c:6: error: 'sc'

[Bug other/36901] pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors

2008-08-09 Thread manu at gcc dot gnu dot org


--- Comment #10 from manu at gcc dot gnu dot org  2008-08-09 20:38 ---
Yeah, silly me, it obviously fails because there is no next pr36901.h to
include.

Since we include limits.h, we are at the mercy of the contents of the limits.h
that is found. This isn't very reliable. We just need to a pedantic warning in
the header. This works in x86_64, could you test on your side?


Index: gcc/testsuite/gcc.dg/pr36901-3.c
===
--- gcc/testsuite/gcc.dg/pr36901-3.c(revision 138906)
+++ gcc/testsuite/gcc.dg/pr36901-3.c(working copy)
@@ -4,7 +4,6 @@
 void foo(void)
 {
   int s = sc;
 }
 /* { dg-message file included In file included { target *-*-* } 0 } */
-/* { dg-warning overflow overflow { target *-*-* } 0 } */
-/* { dg-error overflow overflow { target *-*-* } 0 } */
+/* { dg-error ordered comparison of pointer with integer zero pedantic
error { target *-*-* } 0 } */
Index: gcc/testsuite/gcc.dg/pr36901-4.c
===
--- gcc/testsuite/gcc.dg/pr36901-4.c(revision 138906)
+++ gcc/testsuite/gcc.dg/pr36901-4.c(working copy)
@@ -4,8 +4,6 @@
 void foo(void)
 {
   int s = sc;
 }
 /* { dg-message from  In file included { target *-*-* } 0 } */
-/* { dg-warning overflow overflow { target *-*-* } 0 } */
-/* { dg-error overflow overflow { target *-*-* } 0 } */
-/* { dg-error #include_next is a GCC extension #include_next { target
*-*-* } 0 } */
+/* { dg-error ordered comparison of pointer with integer zero pedantic
error { target *-*-* } 0 } */
Index: gcc/testsuite/gcc.dg/pr36901.h
===
--- gcc/testsuite/gcc.dg/pr36901.h  (revision 138906)
+++ gcc/testsuite/gcc.dg/pr36901.h  (working copy)
@@ -1,2 +1,2 @@
-#include limits.h
-static int sc = INT_MAX + 1;
+int sc = (sc  0);
+


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36901



[Bug other/36901] pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors

2008-08-09 Thread eric dot weddington at atmel dot com


--- Comment #11 from eric dot weddington at atmel dot com  2008-08-10 03:13 
---
(In reply to comment #10)

 Since we include limits.h, we are at the mercy of the contents of the limits.h
 that is found. This isn't very reliable. We just need to a pedantic warning in
 the header. This works in x86_64, could you test on your side?

Yes, this patch causes all of the tests to pass for the AVR.

Thanks for working to find a solution for the AVR target.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36901



[Bug other/36901] pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors

2008-08-08 Thread manu at gcc dot gnu dot org


--- Comment #4 from manu at gcc dot gnu dot org  2008-08-08 23:58 ---
Subject: Bug 36901

Author: manu
Date: Fri Aug  8 23:57:19 2008
New Revision: 138893

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=138893
Log:
2008-08-09  Manuel Lopez-Ibanez  [EMAIL PROTECTED]

PR 36901
* diagnostic.def (DK_PEDWARN, DK_PERMERROR): New.  
* diagnostic.c (pedantic_warning_kind, permissive_error_kind):
Moved from diagnostic.h
(diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and
DK_PERMERROR.
(emit_diagnostic): New.
(warning0, pedwarn0): Delete.
(warning, warning_at, pedwarn, permerror): Return bool.  
* diagnostic.h (pedantic_warning_kind, permissive_error_kind):
Moved to diagnostic.c.
(struct diagnostic_context): Use correct type for
classify_diagnostic.
(diagnostic_report_diagnostic): Update declaration.
(emit_diagnostic): Declare.
* errors.c (warning): Return bool.  
* errors.h (warning): Update declaration.
* toplev.h (warning0, pedwarn0): Delete.
(warning, warning_at, pedwarn, permerror): Return bool.
* c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN.
* c-decl.c (locate_old_decl): Delete 'diag' argument. Always use
inform. Update all calls.
(diagnose_mismatched_decls): Check return value of warning/pedwarn
before giving informative note.
(implicit_decl_warning): Likewise.  
* c-typeck.c (build_function_call): Likewise.  
* tree-sssa.c (warn_uninit): Likewise.  
* builtins.c (gimplify_va_arg_expr): Likewise.
fortran/
* f95-lang.c (gfc_mark_addressable): Use pedwarn (0, instead of
'pedwarn0'.
cp/
* cp-tree.h (struct diagnostic_context, struct diagnostic_info):
Delete forward declarations. Check that toplev.h has not been
included before this file. Include toplev.h and diagnostic.h.
* error.c (cp_cpp_error): Use DK_PEDWARN.
(cxx_incomplete_type_diagnostic): Update declaration.
(cxx_incomplete_type_error): Use DK_ERROR.
* typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t
as argument. Use emit_diagnostic.
(cxx_incomplete_type_error): Use DK_ERROR.
(add_exception_specifier): Use diagnostic_t instead of custom
codes.  
* typeck.c (complete_type_or_else): Update call to
cxx_incomplete_type_diagnostic.
* init.c (build_delete): Likewise.  
* call.c (diagnostic_fn_t): Remove unused typedef.
(build_temp): Pass a pointer to diagnostic_t.
(convert_like_real): Use emit_diagnostic.
(joust): Check return value of warning before giving informative
note.  
* friend.c (do_friend): Check return value of warning
before giving informative note.
* parser.c (cp_parser_template_id): Likewise.

testsuite/
* gcc.dg/pr36901-1.c: New.
* gcc.dg/pr36901-3.c: New.
* gcc.dg/pr36901-2.c: New.
* gcc.dg/pr36901-4.c: New.
* gcc.dg/pr36901-system.h: New.
* gcc.dg/pr36901.h: New.
* gcc.target/powerpc/altivec-macros.c: Update.
* gcc.target/i386/regparm.c: Update.
* gcc.dg/funcdef-var-1.c: Update.
* gcc.dg/parm-mismatch-1.c: Update.
* gcc.dg/attr-noinline.c: Update.
* gcc.dg/wtr-static-1.c: Update.
* gcc.dg/redecl-11.c: Update.
* gcc.dg/pr27953.c: Update.
* gcc.dg/proto-1.c: Update.
* gcc.dg/decl-3.c: Update.
* gcc.dg/redecl-13.c: Update.
* gcc.dg/pr15360-1.c: Update.
* gcc.dg/redecl-15.c: Update.
* gcc.dg/enum-compat-1.c: Update.
* gcc.dg/dll-3.c: Update.
* gcc.dg/array-5.c: Update.
* gcc.dg/Wredundant-decls-2.c: Update.
* gcc.dg/inline4.c: Update.
* gcc.dg/redecl-2.c: Update.
* gcc.dg/inline-14.c: Update.
* gcc.dg/tls/diag-3.c: Update.
* gcc.dg/funcdef-var-2.c: Update.
* gcc.dg/20041213-1.c: Update.
* gcc.dg/old-style-then-proto-1.c: Update.
* gcc.dg/decl-2.c: Update.
* gcc.dg/redecl-12.c: Update.
* gcc.dg/decl-4.c: Update.
* gcc.dg/Wshadow-1.c: Update.
* gcc.dg/transparent-union-2.c: Update.
* gcc.dg/visibility-7.c: Update.
* gcc.dg/dll-2.c: Update.
* gcc.dg/redecl-16.c: Update.
* gcc.dg/inline1.c: Update.
* gcc.dg/decl-8.c: Update.
* gcc.dg/nested-redef-1.c: Update.
* gcc.dg/inline3.c: Update.
* gcc.dg/redecl-1.c: Update.
* gcc.dg/inline5.c: Update.
* gcc.dg/pr35899.c: Update.
* gcc.dg/noncompile/label-lineno-1.c: Update.
* gcc.dg/noncompile/label-1.c: Update.
* gcc.dg/noncompile/20020220-1.c: Update.
* gcc.dg/noncompile/redecl-1.c: Update.
* gcc.dg/redecl-5.c: Update.
* gcc.dg/qual-return-3.c: 

[Bug other/36901] pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors

2008-08-08 Thread manu at gcc dot gnu dot org


--- Comment #5 from manu at gcc dot gnu dot org  2008-08-08 23:59 ---
Fixed in GCC 4.4


-- 

manu at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||FIXED
   Target Milestone|--- |4.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36901



[Bug other/36901] pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors

2008-07-22 Thread manu at gcc dot gnu dot org


--- Comment #1 from manu at gcc dot gnu dot org  2008-07-22 16:30 ---
One testcase could use #include_next in a system header and compile with just
-pedantic-errors. This should be silent but it currently emits an error.

Another testcase could be just:

static int sc = INT_MAX + 1; 

compiled with -pedantic-errors -w. This should be silent as well, but it will
give an error.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36901



[Bug other/36901] pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors

2008-07-22 Thread paolo dot carlini at oracle dot com


--- Comment #2 from paolo dot carlini at oracle dot com  2008-07-22 17:29 
---
Thanks a lot Manuel! Maybe I will even be able to come to this, thanks to your
suggestions for a fix.


-- 

paolo dot carlini at oracle dot com changed:

   What|Removed |Added

 CC||paolo at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36901



[Bug other/36901] pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors

2008-07-22 Thread manu at gcc dot gnu dot org


--- Comment #3 from manu at gcc dot gnu dot org  2008-07-22 18:07 ---
(In reply to comment #2)
 Thanks a lot Manuel! Maybe I will even be able to come to this, thanks to your
 suggestions for a fix.
 

I think there is a problem with my suggestion: -pedantic-errors does not only
affect -pedantic warnings but it also affects pedwarns that are not controlled
by -pedantic. -Werror=pedantic would only affect those warnings controlled by
-pedantic, so it would not be equivalent to -pedantic-errors. :( 

At the moment where diagnostic_report_diagnostic checks
diagnostic_report_warnings_p (location), the machinery does not know that this
is a pedwarn. I guess we could pass a special code DK_PEDWARN, and test for
flag_pedantic_errors within diagnostic_report_diagnostic so we can reclassify
it as DK_ERROR or DK_WARNING; or we could pass a special code DK_PEDERROR and
for that code also check diagnostic_report_warnings_p before reclassifying it
to DK_ERROR; or we could make a call to diagnostic_report_warnings_p (location)
directly in pedwarn before passing down a DK_ERROR. 

Sorry I can't be more precise. This needs more time to think that I have
available.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36901