public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19564] New: -Wparentheses and other warnings: g++ is less sensitive than gcc
@ 2005-01-21 13:40 fm3 at os dot inf dot tu-dresden dot de
  2005-01-21 14:11 ` [Bug c++/19564] -Wparentheses does not work with the C++ front-end pinskia at gcc dot gnu dot org
  2005-01-21 14:12 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 11+ messages in thread
From: fm3 at os dot inf dot tu-dresden dot de @ 2005-01-21 13:40 UTC (permalink / raw)
  To: gcc-bugs

g++ generates less warnings when using -Wparentheses than gcc. For instance  
gcc warns about  
  
  if (a>0 & b>0)  
    ...  
  
(warning: suggest parentheses around comparison in operand of &) but g++ does  
not. And gcc warns about  
  
  char a = 1024;  
  
(warning: overflow in implicit constant conversion) but g++ does not.

-- 
           Summary: -Wparentheses and other warnings: g++ is less sensitive
                    than gcc
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fm3 at os dot inf dot tu-dresden dot de
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i486-linux


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/19564] -Wparentheses does not work with the C++ front-end
  2005-01-21 13:40 [Bug c++/19564] New: -Wparentheses and other warnings: g++ is less sensitive than gcc fm3 at os dot inf dot tu-dresden dot de
@ 2005-01-21 14:11 ` pinskia at gcc dot gnu dot org
  2005-01-21 14:12 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-21 14:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-21 14:11 -------
(In reply to comment #0)
> g++ generates less warnings when using -Wparentheses than gcc. For instance  
> gcc warns about  
>   
>   if (a>0 & b>0)  
>     ...  

This because this warning is only in the C front-end.

Please file the "overflow in implicit constant conversion" warning into a different bug.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2005-01-21 14:11:16
               date|                            |
            Summary|-Wparentheses and other     |-Wparentheses does not work
                   |warnings: g++ is less       |with the C++ front-end
                   |sensitive than gcc          |


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/19564] -Wparentheses does not work with the C++ front-end
  2005-01-21 13:40 [Bug c++/19564] New: -Wparentheses and other warnings: g++ is less sensitive than gcc fm3 at os dot inf dot tu-dresden dot de
  2005-01-21 14:11 ` [Bug c++/19564] -Wparentheses does not work with the C++ front-end pinskia at gcc dot gnu dot org
@ 2005-01-21 14:12 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-21 14:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-21 14:12 -------
Note here is the testcase:
int f(int a, int b)
{
    if (a>0 & b>0) /* { dg-warning "" } */
     return 210;
  return 0;

}

-- 


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/19564] -Wparentheses does not work with the C++ front-end
       [not found] <bug-19564-9973@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2006-12-14  6:03 ` ian at airs dot com
@ 2007-06-10  8:39 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-06-10  8:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pinskia at gcc dot gnu dot org  2007-06-10 08:38 -------
*** Bug 32270 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at little-bat dot
                   |                            |de


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/19564] -Wparentheses does not work with the C++ front-end
       [not found] <bug-19564-9973@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2006-12-14  5:49 ` ian at gcc dot gnu dot org
@ 2006-12-14  6:03 ` ian at airs dot com
  2007-06-10  8:39 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: ian at airs dot com @ 2006-12-14  6:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from ian at airs dot com  2006-12-14 06:03 -------
Will be fixed in gcc 4.3.


-- 

ian at airs dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/19564] -Wparentheses does not work with the C++ front-end
       [not found] <bug-19564-9973@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2006-12-12 18:01 ` patchapp at dberlin dot org
@ 2006-12-14  5:49 ` ian at gcc dot gnu dot org
  2006-12-14  6:03 ` ian at airs dot com
  2007-06-10  8:39 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: ian at gcc dot gnu dot org @ 2006-12-14  5:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from ian at gcc dot gnu dot org  2006-12-14 05:49 -------
Subject: Bug 19564

Author: ian
Date: Thu Dec 14 05:49:06 2006
New Revision: 119855

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119855
Log:
        PR c++/19564
        PR c++/19756
gcc/:
        * c-typeck.c (parser_build_binary_op): Move parentheses warnings
        to warn_about_parentheses in c-common.c.
        * c-common.c (warn_about_parentheses): New function.
        * c-common.h (warn_about_parentheses): Declare.
        * doc/invoke.texi (Warning Options): Update -Wparentheses
        description.
gcc/cp/:
        * parser.c (cp_parser_expression_stack_entry): Add field
        lhs_type.
        (cp_parser_binary_expression): Track tree code of left hand side
        of expression.  Use it when calling build_x_binary_op.
        (cp_parser_selection_statement): Add if_p parameter.  Change all
        callers.  Warn about ambiguous else.
        (cp_parser_statement): Add if_p parameter.  Change all callers.
        (cp_parser_implicitly_scoped_statement): Likewise.
        * typeck.c (build_x_binary_op): Add parameters arg1_code and
        arg2_code.  Change all callers.  Call warn_about_parentheses.
        * cp-tree.h (build_x_binary_op): Update declaration.
gcc/testsuite/:
        * g++.dg/warn/Wparentheses-5.C: New test.
        * g++.dg/warn/Wparentheses-6.C: New test.
        * g++.dg/warn/Wparentheses-7.C: New test.
        * g++.dg/warn/Wparentheses-8.C: New test.
        * g++.dg/warn/Wparentheses-9.C: New test.
        * g++.dg/warn/Wparentheses-10.C: New test.
        * g++.dg/warn/Wparentheses-11.C: New test.
        * g++.dg/warn/Wparentheses-12.C: New test.
        * g++.dg/warn/Wparentheses-13.C: New test.
        * g++.dg/warn/Wparentheses-14.C: New test.
        * g++.dg/warn/Wparentheses-15.C: New test.
        * g++.dg/warn/Wparentheses-16.C: New test.
        * g++.dg/warn/Wparentheses-17.C: New test.
        * g++.dg/warn/Wparentheses-18.C: New test.
        * g++.dg/warn/Wparentheses-19.C: New test.
        * g++.dg/warn/Wparentheses-20.C: New test.
        * g++.dg/warn/Wparentheses-21.C: New test.
libstdc++-v3/:
        * include/bits/locale_facets.tcc (num_get<>::_M_extract_float):
        Add parentheses around && within || to avoid warning.
        (num_get<>::_M_extract_int): Likewise.
        (money_get<>::_M_extract): Likewise.
        (num_get<>::do_get(iter_type, iter_type, ios_base&,
        ios_base::iostate&, void*&)): Add parentheses around & within | to
        avoid warning.
        (num_put<>::do_put(iter_type, ios_base&, char_type, const void*)):
        Likewise.
        * include/bits/streambuf_iterator.h (istreambuf_iterator::equal):
        Add parentheses around && within || to avoid warning.
        * libsupc++/tinfo.cc (__do_dyncast): Likewise.
        * src/locale.cc (locale::_S_normalize_category): Likewise.
        * include/bits/stl_tree.h (_Rb_tree<>::_M_insert_unique): Add
        braces to avoid ambiguous else warning.
        * src/strstream.cc (strstreambuf::_M_free): Likewise.
        * src/tree.cc (_Rb_tree_rebalance_for_erase): Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/warn/Wparentheses-10.C
    trunk/gcc/testsuite/g++.dg/warn/Wparentheses-11.C
    trunk/gcc/testsuite/g++.dg/warn/Wparentheses-12.C
    trunk/gcc/testsuite/g++.dg/warn/Wparentheses-13.C
    trunk/gcc/testsuite/g++.dg/warn/Wparentheses-14.C
    trunk/gcc/testsuite/g++.dg/warn/Wparentheses-15.C
    trunk/gcc/testsuite/g++.dg/warn/Wparentheses-16.C
    trunk/gcc/testsuite/g++.dg/warn/Wparentheses-17.C
    trunk/gcc/testsuite/g++.dg/warn/Wparentheses-18.C
    trunk/gcc/testsuite/g++.dg/warn/Wparentheses-19.C
    trunk/gcc/testsuite/g++.dg/warn/Wparentheses-20.C
    trunk/gcc/testsuite/g++.dg/warn/Wparentheses-21.C
    trunk/gcc/testsuite/g++.dg/warn/Wparentheses-5.C
    trunk/gcc/testsuite/g++.dg/warn/Wparentheses-6.C
    trunk/gcc/testsuite/g++.dg/warn/Wparentheses-7.C
    trunk/gcc/testsuite/g++.dg/warn/Wparentheses-8.C
    trunk/gcc/testsuite/g++.dg/warn/Wparentheses-9.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-common.c
    trunk/gcc/c-common.h
    trunk/gcc/c-typeck.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/typeck.c
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/locale_facets.tcc
    trunk/libstdc++-v3/include/bits/stl_tree.h
    trunk/libstdc++-v3/include/bits/streambuf_iterator.h
    trunk/libstdc++-v3/libsupc++/tinfo.cc
    trunk/libstdc++-v3/src/locale.cc
    trunk/libstdc++-v3/src/strstream.cc
    trunk/libstdc++-v3/src/tree.cc


-- 


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/19564] -Wparentheses does not work with the C++ front-end
       [not found] <bug-19564-9973@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2006-12-12 18:00 ` ian at airs dot com
@ 2006-12-12 18:01 ` patchapp at dberlin dot org
  2006-12-14  5:49 ` ian at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: patchapp at dberlin dot org @ 2006-12-12 18:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from patchapp at dberlin dot org  2006-12-12 18:00 -------
Subject: Bug number PR c++/19564

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/2006-12/msg00868.html


-- 


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/19564] -Wparentheses does not work with the C++ front-end
       [not found] <bug-19564-9973@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2006-12-01  6:18 ` ian at airs dot com
@ 2006-12-12 18:00 ` ian at airs dot com
  2006-12-12 18:01 ` patchapp at dberlin dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: ian at airs dot com @ 2006-12-12 18:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from ian at airs dot com  2006-12-12 18:00 -------
Copyright status is cleared, my patch is here:
    http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00868.html


-- 

ian at airs dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/19564] -Wparentheses does not work with the C++ front-end
       [not found] <bug-19564-9973@http.gcc.gnu.org/bugzilla/>
  2006-02-08 17:56 ` ian at airs dot com
  2006-11-30 23:15 ` mueller at gcc dot gnu dot org
@ 2006-12-01  6:18 ` ian at airs dot com
  2006-12-12 18:00 ` ian at airs dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: ian at airs dot com @ 2006-12-01  6:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from ian at airs dot com  2006-12-01 06:18 -------
The patches are ready to go in as soon as Google's copyright assignment clears.
 The assignment has been signed on both sides and is in the mail, or so I am
told.


-- 


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/19564] -Wparentheses does not work with the C++ front-end
       [not found] <bug-19564-9973@http.gcc.gnu.org/bugzilla/>
  2006-02-08 17:56 ` ian at airs dot com
@ 2006-11-30 23:15 ` mueller at gcc dot gnu dot org
  2006-12-01  6:18 ` ian at airs dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: mueller at gcc dot gnu dot org @ 2006-11-30 23:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from mueller at gcc dot gnu dot org  2006-11-30 23:15 -------
what is the status of these patches? I just started to look into this..


-- 

mueller at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mueller at gcc dot gnu dot
                   |                            |org


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/19564] -Wparentheses does not work with the C++ front-end
       [not found] <bug-19564-9973@http.gcc.gnu.org/bugzilla/>
@ 2006-02-08 17:56 ` ian at airs dot com
  2006-11-30 23:15 ` mueller at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: ian at airs dot com @ 2006-02-08 17:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ian at airs dot com  2006-02-08 17:56 -------
I have a patch to add full support for -Wparentheses to the C++ frontend, which
I will submit when copyright status is cleared up.


-- 

ian at airs dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ian at airs dot com


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-06-10  8:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-21 13:40 [Bug c++/19564] New: -Wparentheses and other warnings: g++ is less sensitive than gcc fm3 at os dot inf dot tu-dresden dot de
2005-01-21 14:11 ` [Bug c++/19564] -Wparentheses does not work with the C++ front-end pinskia at gcc dot gnu dot org
2005-01-21 14:12 ` pinskia at gcc dot gnu dot org
     [not found] <bug-19564-9973@http.gcc.gnu.org/bugzilla/>
2006-02-08 17:56 ` ian at airs dot com
2006-11-30 23:15 ` mueller at gcc dot gnu dot org
2006-12-01  6:18 ` ian at airs dot com
2006-12-12 18:00 ` ian at airs dot com
2006-12-12 18:01 ` patchapp at dberlin dot org
2006-12-14  5:49 ` ian at gcc dot gnu dot org
2006-12-14  6:03 ` ian at airs dot com
2007-06-10  8:39 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).