First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 24924
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: Joseph S. Myers <jsm28@gcc.gnu.org>
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 24924 depends on: Show dependency tree
Show dependency graph
Bug 24924 blocks: 33702

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2006-02-20 18:28 Opened: 2005-11-17 20:21
The C++ front end makes pedwarns into errors by default (unless -fpermissive). 
However, this only applies to front end pedwarns and not to preprocessor ones,
as the preprocessor has its own pedantic_errors setting which is changed by an
explicit -pedantic-errors option but doesn't default to 1 for C++ the way the
global setting does.

There should be a consistent pedantic_errors setting for both compiler and
preprocessor pedwarns.

Test: preprocess a testcase such as

#if 1
#endif 1

and observe it gives a warning which becomes an error with -pedantic-errors,
whereas by the principle followed by the C++ front end it should be an error
which becomes a warning with -fpermissive.

------- Comment #1 From Andrew Pinski 2005-11-17 20:26 -------
Confirmed.

------- Comment #2 From patchapp@dberlin.org 2007-01-27 09:15 -------
Subject: Bug number PR24924

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-01/msg02234.html

------- Comment #3 From Manuel López-Ibáñez 2007-03-15 22:24 -------
Subject: Bug 24924

Author: manu
Date: Thu Mar 15 22:24:42 2007
New Revision: 122961

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122961
Log:
2007-03-15  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

        PR c++/24924
        * c-opts.c (c_common_post_options): Handle C++ post-processing here.
        Set also -pedantic-errors by default for the  preprocessor unless
        -fpermissive is given.
cp/
        * decl.c (cxx_init_decl_processing): Move command-line options
        processing to c-opts.c.
testsuite/
        * g++.dg/cpp/pedantic-errors.C: New.
        * g++.dg/cpp/permissive.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp/pedantic-errors.C
    trunk/gcc/testsuite/g++.dg/cpp/permissive.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-opts.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog

------- Comment #4 From Manuel López-Ibáñez 2007-03-15 22:49 -------
Fixed for GCC 4.3

------- Comment #5 From Manuel López-Ibáñez 2008-01-14 19:18 -------
The fix was reverted so REOPEN.

There is a patch available for 4.4:
http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00583.html

------- Comment #6 From Manuel López-Ibáñez 2008-01-14 19:22 -------
Subject: Bug 24924

Author: manu
Date: Mon Jan 14 19:21:38 2008
New Revision: 131530

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131530
Log:
2008-01-14  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

        PR c++/24924
        * c-opts (c_common_post_options): Do not enable CPP
        flag_pedantic_errors by default.
testsuite/
        * g++.dg/cpp/pedantic-errors.C: Delete.
        * g++.dg/cpp/permissive.C: Delete.

Removed:
    trunk/gcc/testsuite/g++.dg/cpp/pedantic-errors.C
    trunk/gcc/testsuite/g++.dg/cpp/permissive.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-opts.c
    trunk/gcc/testsuite/ChangeLog

------- Comment #7 From Manuel López-Ibáñez 2008-03-02 15:46 -------
Subject: Bug 24924

Author: manu
Date: Sun Mar  2 15:45:29 2008
New Revision: 132817

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132817
Log:
2008-03-02  Manuel Lopez-Ibanez  <manu@gcc.gnu.org> 

        PR 24924
        * c-common.c (flag_permissive): Delete.
        (constant_expression_warnings): Check flags first.
        (constant_expression_error): New.
        * c-common.h (flag_permissive): Delete.
        (constant_expression_error): Declare.
        * flags.h (flag_permissive): Declare. Update description.
        * diagnostic.c (pedwarn): Update.
        (permerror): New.
        * diagnostic.h: (pedantic_error_kind): Rename as pedantic_warning_kind.
        (permissive_error_kind): New.
        * toplev.c (flag_permissive): Define. Update description.
        * toplev.h (permissive_error_kind): Declare.
        * c-errors.c (pedwarn_c99): Use pedantic_warning_kind.
        (pedwarn_c90): Use pedantic_warning_kind.
        * c-opts.c (c_common_post_options): flag_permissive does not affect
        flag_pedantic_errors.
cp/
        * class.c (finish_struct_anon): Use permerror instead of pedwarn.
        (check_field_decls): Likewise.
        (note_name_declared_in_class): Likewise.
        * call.c (build_new_op): Likewise.
        (convert_like_real): Likewise.
        (build_over_call): Likewise.
        * lex.c (unqualified_fn_lookup_error): Likewise.
        * parser.c (cp_parser_template_id): Likewise.
        * cvt.c (warn_ref_binding): Likewise.
        (convert_to_reference): Likewise.
        (ocp_convert): Likewise.
        (convert_to_void): Use error instead of pedwarn.
        * error.c (cp_cpp_error): Use pedantic_warning_kind.
        * decl.c (compute_array_index_type): Use constant_expression_error.
testsuite/
        * g++.dg/cpp/string-2.C: This is a warning now.
        * g++.dg/cpp/pedantic-errors.C: -pedantic-errors is not enabled by
        default, so add it.

Added:
    trunk/gcc/testsuite/g++.dg/cpp/pedantic-errors.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-common.c
    trunk/gcc/c-common.h
    trunk/gcc/c-errors.c
    trunk/gcc/c-opts.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/cp/class.c
    trunk/gcc/cp/cvt.c
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/error.c
    trunk/gcc/cp/lex.c
    trunk/gcc/cp/parser.c
    trunk/gcc/diagnostic.c
    trunk/gcc/diagnostic.h
    trunk/gcc/flags.h
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/cpp/string-2.C
    trunk/gcc/toplev.c
    trunk/gcc/toplev.h

------- Comment #8 From Manuel López-Ibáñez 2008-03-03 10:56 -------
This is fixed for 4.4 by introducing permerror which makes -fpermissive
completely independent of -pedantic and -pedantic-errors.

First Last Prev Next    No search results available      Search page      Enter new bug