[Bug fortran/30929] -pedantic-error and -Werror don't produce errors!
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30929 Harald Anlauf changed: What|Removed |Added CC||anlauf at gmx dot de --- Comment #8 from Harald Anlauf --- The following patch produces the desired error for the example of comment #0: --- gcc/fortran/primary.c (revision 232904) +++ gcc/fortran/primary.c (working copy) @@ -1698,7 +1698,9 @@ } } - if (!gfc_notify_std (GFC_STD_GNU, "argument list function at %C")) + if (!gfc_notify_std (GFC_STD_GNU, "argument list function at %C") || + (pedantic && + !gfc_warning (OPT_Wpedantic, "Extension: argument list function at %C"))) { m = MATCH_ERROR; goto cleanup; % gfc-trunk -c -Werror=pedantic gcc/testsuite/gfortran.dg/c_by_val_4.f gcc/testsuite/gfortran.dg/c_by_val_4.f:14:22: CALL DOIT( %VAL( P ) ) ! { dg-warning "Extension: argument list function" } 1 Error: Extension: argument list function at (1) [-Werror=pedantic] gcc/testsuite/gfortran.dg/c_by_val_4.f:16:22: CALL DOIT( %VAL( P ) ) ! { dg-warning "Extension: argument list function" } 1 Error: Extension: argument list function at (1) [-Werror=pedantic] A more general solution might be to extend gfc_notify_std to generally handle extensions.
[Bug fortran/30929] -pedantic-error and -Werror don't produce errors!
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30929 Manuel López-Ibáñez changed: What|Removed |Added CC||manu at gcc dot gnu.org --- Comment #7 from Manuel López-Ibáñez --- An update given the new diagnostics machinery: * -Werror works as expected (comment #2) * -pedantic-errors (-Werror=pedantic) should give errors for anything marked with -Wpedantic such as: gfc_warning (OPT_Wpedantic, "Extension: backslash character at %C"); However, Fortran does not seem to use OPT_Wpedantic. You could use LangEnabledBy to enable with it whatever option you wish.
[Bug fortran/30929] -pedantic-error and -Werror don't produce errors!
--- Comment #6 from manu at gcc dot gnu dot org 2007-07-04 13:08 --- (In reply to comment #4) > > No idea how to untangle -pedantic from -Wtabs or -Wampersand if > -pedantic-errors has been given, but -Werror has not. > What gfortran should do is that if pedantic enables Wtabs, then the warnings should be of the form: if (pedantic && warn_tabs) pedantic("whatever"); else if (warn_tabs) warning("whatever"); pedantic() emits errors if -pedantic-errors, otherwise it emits warnings. warning() emits errors if -Werror, otherwise it emits warnings. I guess there would be similar functions in gfortran. (It would be great to integrate the diagnostics machinery but making things work in a similar way is already a step forward). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30929
[Bug fortran/30929] -pedantic-error and -Werror don't produce errors!
-- fxcoudert at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2007-03-18 18:05:25 date|| Summary|-pedantic-error produced|-pedantic-error and -Werror |only warnings and no errors |don't produce errors! http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30929