public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers
@ 2020-07-05  0:41 ian.s.mcinerney at ieee dot org
  2020-07-06 11:45 ` [Bug libstdc++/96063] " redi at gcc dot gnu.org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: ian.s.mcinerney at ieee dot org @ 2020-07-05  0:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

            Bug ID: 96063
           Summary: mismatched-tags warnings in stdlib headers
           Product: gcc
           Version: 10.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ian.s.mcinerney at ieee dot org
  Target Milestone: ---

There are several places in the library headers where warnings can be emitted
for mismatched-tags (this was found when a mingw g++ compile misbehaved and
printed warnings for system headers for some reason). I am still not sure why
the compiler decided to throw the errors in the first place, but these seem
like something that can be cleaned up.

Warnings from building a C++ file that just includes all the headers:

In file included from /usr/include/c++/10/bits/ios_base.h:46,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from main.cpp:7:
/usr/include/c++/10/system_error:54:9: warning: ‘std::error_code’ declared with
a mismatched class-key ‘class’ [-Wmismatched-tags]
   54 |   class error_code;
      |         ^~~~~~~~~~
/usr/include/c++/10/system_error:54:9: note: replace the class-key with
‘struct’
/usr/include/c++/10/system_error:180:10: note: ‘std::error_code’ defined as
‘struct’ here
  180 |   struct error_code
      |          ^~~~~~~~~~
/usr/include/c++/10/system_error:55:9: warning: ‘std::error_condition’ declared
with a mismatched class-key ‘class’ [-Wmismatched-tags]
   55 |   class error_condition;
      |         ^~~~~~~~~~~~~~~
/usr/include/c++/10/system_error:55:9: note: replace the class-key with
‘struct’
/usr/include/c++/10/system_error:278:10: note: ‘std::error_condition’ defined
as ‘struct’ here
  278 |   struct error_condition
      |          ^~~~~~~~~~~~~~~


In file included from /usr/include/c++/10/string:43,
                 from /usr/include/c++/10/bitset:47,
                 from main.cpp:6:
/usr/include/c++/10/bits/localefwd.h:125:9: warning: ‘std::ctype_base’ declared
with a mismatched class-key ‘class’ [-Wmismatched-tags]
  125 |   class ctype_base;
      |         ^~~~~~~~~~
/usr/include/c++/10/bits/localefwd.h:125:9: note: replace the class-key with
‘struct’
In file included from /usr/include/c++/10/bits/locale_facets.h:41,
                 from /usr/include/c++/10/bits/basic_ios.h:37,
                 from /usr/include/c++/10/ios:44,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from main.cpp:7:
/usr/include/c++/10/x86_64-redhat-linux/bits/ctype_base.h:41:10: note:
‘std::ctype_base’ defined as ‘struct’ here
   41 |   struct ctype_base
      |          ^~~~~~~~~~


In file included from main.cpp:7:
/usr/include/c++/10/complex:67:32: warning: ‘std::complex<_Tp>’ declared with a
mismatched class-key ‘class’ [-Wmismatched-tags]
   67 |   template<typename _Tp> class complex;
      |                                ^~~~~~~
/usr/include/c++/10/complex:67:32: note: replace the class-key with ‘struct’
/usr/include/c++/10/complex:127:12: note: ‘std::complex<_Tp>’ defined as
‘struct’ here
  127 |     struct complex
      |            ^~~~~~~
/usr/include/c++/10/complex:68:20: warning: ‘std::complex<float>’ declared with
a mismatched class-key ‘class’ [-Wmismatched-tags]
   68 |   template<> class complex<float>;
      |                    ^~~~~~~~~~~~~~
/usr/include/c++/10/complex:68:20: note: replace the class-key with ‘struct’
/usr/include/c++/10/complex:1082:12: note: ‘std::complex<float>’ defined as
‘struct’ here
 1082 |     struct complex<float>
      |            ^~~~~~~~~~~~~~
/usr/include/c++/10/complex:69:20: warning: ‘std::complex<double>’ declared
with a mismatched class-key ‘class’ [-Wmismatched-tags]
   69 |   template<> class complex<double>;
      |                    ^~~~~~~~~~~~~~~
/usr/include/c++/10/complex:69:20: note: replace the class-key with ‘struct’
/usr/include/c++/10/complex:1227:12: note: ‘std::complex<double>’ defined as
‘struct’ here
 1227 |     struct complex<double>
      |            ^~~~~~~~~~~~~~~
/usr/include/c++/10/complex:70:20: warning: ‘std::complex<long double>’
declared with a mismatched class-key ‘class’ [-Wmismatched-tags]
   70 |   template<> class complex<long double>;
      |                    ^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/complex:70:20: note: replace the class-key with ‘struct’
/usr/include/c++/10/complex:1372:12: note: ‘std::complex<long double>’ defined
as ‘struct’ here
 1372 |     struct complex<long double>
      |            ^~~~~~~~~~~~~~~~~~~~


In file included from /usr/include/c++/10/string:43,
                 from /usr/include/c++/10/bitset:47,
                 from main.cpp:6:
/usr/include/c++/10/bits/localefwd.h:203:9: warning: ‘std::messages_base’
declared with a mismatched class-key ‘class’ [-Wmismatched-tags]
  203 |   class messages_base;
      |         ^~~~~~~~~~~~~
/usr/include/c++/10/bits/localefwd.h:203:9: note: replace the class-key with
‘struct’
In file included from /usr/include/c++/10/locale:41,
                 from /usr/include/c++/10/iomanip:43,
                 from main.cpp:12:
/usr/include/c++/10/bits/locale_facets_nonio.h:1770:10: note:
‘std::messages_base’ defined as ‘struct’ here
 1770 |   struct messages_base
      |          ^~~~~~~~~~~~~


In file included from /usr/include/c++/10/future:39,
                 from main.cpp:46:
/usr/include/c++/10/thread:100:20: warning: ‘std::hash<std::thread::id>’
declared with a mismatched class-key ‘class’ [-Wmismatched-tags]
  100 |       friend class hash<id>;
      |                    ^~~~~~~~
/usr/include/c++/10/thread:100:20: note: replace the class-key with ‘struct’
/usr/include/c++/10/thread:338:12: note: ‘std::hash<std::thread::id>’ defined
as ‘struct’ here
  338 |     struct hash<thread::id>
      |            ^~~~~~~~~~~~~~~~


In file included from /usr/include/c++/10/regex:61,
                 from main.cpp:51:
/usr/include/c++/10/bits/regex_compiler.h:37:11: warning:
‘std::__cxx11::regex_traits< <template-parameter-1-1> >’ declared with a
mismatched class-key ‘class’ [-Wmismatched-tags]
   37 |     class regex_traits;
      |           ^~~~~~~~~~~~
/usr/include/c++/10/bits/regex_compiler.h:37:11: note: replace the class-key
with ‘struct’
In file included from /usr/include/c++/10/regex:62,
                 from main.cpp:51:


/usr/include/c++/10/bits/regex.h:80:12: note: ‘std::__cxx11::regex_traits<
<template-parameter-1-1> >’ defined as ‘struct’ here
   80 |     struct regex_traits
      |            ^~~~~~~~~~~~


In file included from main.cpp:35:
/usr/include/c++/10/valarray:574:20: warning: ‘std::_Array<_Tp>’ declared with
a mismatched class-key ‘class’ [-Wmismatched-tags]
  574 |       friend class _Array<_Tp>;
      |                    ^~~~~~~~~~~
/usr/include/c++/10/valarray:574:20: note: replace the class-key with ‘struct’
In file included from /usr/include/c++/10/valarray:100,
                 from main.cpp:35:
/usr/include/c++/10/bits/valarray_array.h:396:12: note: ‘std::_Array<_Tp>’
defined as ‘struct’ here
  396 |     struct _Array
      |            ^~~~~~


In file included from main.cpp:46:
/usr/include/c++/10/future:1051:57: warning:
‘std::__future_base::_State_baseV2::_Setter<_Res, _Arg>’ declared with a
mismatched class-key ‘class’ [-Wmismatched-tags]
 1051 |       template<typename, typename> friend class _State::_Setter;
      |                                                         ^~~~~~~
/usr/include/c++/10/future:1051:57: note: replace the class-key with ‘struct’
/usr/include/c++/10/future:462:16: note:
‘std::__future_base::_State_baseV2::_Setter<_Res, _Arg>’ first declared as
‘struct’ here
  462 |         struct _Setter;
      |                ^~~~~~~
/usr/include/c++/10/future:1162:57: warning:
‘std::__future_base::_State_baseV2::_Setter<_Res, _Arg>’ declared with a
mismatched class-key ‘class’ [-Wmismatched-tags]
 1162 |       template<typename, typename> friend class _State::_Setter;
      |                                                         ^~~~~~~
/usr/include/c++/10/future:1162:57: note: replace the class-key with ‘struct’
/usr/include/c++/10/future:1252:57: warning:
‘std::__future_base::_State_baseV2::_Setter<_Res, _Arg>’ declared with a
mismatched class-key ‘class’ [-Wmismatched-tags]
 1252 |       template<typename, typename> friend class _State::_Setter;
      |                                                         ^~~~~~~
/usr/include/c++/10/future:1252:57: note: replace the class-key with ‘struct’





There are a few others emitted by a clang++ build using the GCC standard
library headers:

In file included from main.cpp:5:
In file included from
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/algorithm:64:
In file included from
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/bits/ranges_algo.h:35:
In file included from
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/bits/ranges_algobase.h:38:
In file included from
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/ranges:46:
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/tuple:195:49:
warning: class template '_Tuple_impl' was previously declared as a struct
template; this is valid, but may result in linker errors under the Microsoft
C++ ABI [-Wmismatched-tags]
      template<std::size_t, typename...> friend class _Tuple_impl;
                                                ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/tuple:183:12:
note: previous use is here
    struct _Tuple_impl;
           ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/tuple:344:49:
warning: class template '_Tuple_impl' was previously declared as a struct
template; this is valid, but may result in linker errors under the Microsoft
C++ ABI [-Wmismatched-tags]
      template<std::size_t, typename...> friend class _Tuple_impl;
                                                ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/tuple:183:12:
note: previous use is here
    struct _Tuple_impl;
           ^


In file included from main.cpp:5:
In file included from
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/algorithm:74:
In file included from
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/pstl/glue_algorithm_defs.h:13:
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/functional:401:5:
warning: '_Bind' defined as a class template here but previously declared as a
struct template; this is valid, but may result in linker errors under the
Microsoft C++ ABI [-Wmismatched-tags]
    class _Bind<_Functor(_Bound_args...)>
    ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/functional:398:5:
note: did you mean class here?
    struct _Bind;
    ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/functional:552:5:
warning: '_Bind_result' defined as a class template here but previously
declared as a struct template; this is valid, but may result in linker errors
under the Microsoft C++ ABI [-Wmismatched-tags]
    class _Bind_result<_Result, _Functor(_Bound_args...)>
    ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/functional:549:5:
note: did you mean class here?
    struct _Bind_result;
    ^

In file included from main.cpp:5:
In file included from
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/algorithm:60:
In file included from
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/utility:70:
In file included from
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/bits/stl_pair.h:59:
In file included from
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/bits/move.h:57:
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/type_traits:2535:5:
warning: 'result_of' defined as a struct template here but previously declared
as a class template; this is valid, but may result in linker errors under the
Microsoft C++ ABI [-Wmismatched-tags]
    struct result_of<_Functor(_ArgTypes...)>
    ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/type_traits:2344:5:
note: did you mean struct here?
    class result_of;
    ^

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

* [Bug libstdc++/96063] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
@ 2020-07-06 11:45 ` redi at gcc dot gnu.org
  2020-07-06 16:01 ` ian.s.mcinerney at ieee dot org
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-06 11:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |diagnostic
   Last reconfirmed|                            |2020-07-06

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I'm tempted to just disable the warning in all libstdc++ headers. It's a silly
warning, and the "may result in linker errors under the Microsoft C++ ABI" is a
false alarm in our case (we never *only* declare it without also defining it).

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

* [Bug libstdc++/96063] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
  2020-07-06 11:45 ` [Bug libstdc++/96063] " redi at gcc dot gnu.org
@ 2020-07-06 16:01 ` ian.s.mcinerney at ieee dot org
  2020-07-06 16:15 ` redi at gcc dot gnu.org
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: ian.s.mcinerney at ieee dot org @ 2020-07-06 16:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

--- Comment #2 from Ian McInerney <ian.s.mcinerney at ieee dot org> ---
I'd be fine with disabling them for the library (although I would have hoped
they would have been disabled there from the start since warnings from the
library weren't requested), but as it stands currently the warning can't be
used due to all the noise being generated.

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

* [Bug libstdc++/96063] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
  2020-07-06 11:45 ` [Bug libstdc++/96063] " redi at gcc dot gnu.org
  2020-07-06 16:01 ` ian.s.mcinerney at ieee dot org
@ 2020-07-06 16:15 ` redi at gcc dot gnu.org
  2020-07-06 16:19 ` redi at gcc dot gnu.org
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-06 16:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

Jonathan Wakely <redi at gcc dot gnu.org> changed:

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
That's not the case. You'll only see those warnings with -Wsystem-headers
enabled, which is off by default. So they *are* disabled from the start.

Fixed in r11-1853-0e5abeb0cb06f9798a559e1238839c5d6581657e

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

* [Bug libstdc++/96063] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
                   ` (2 preceding siblings ...)
  2020-07-06 16:15 ` redi at gcc dot gnu.org
@ 2020-07-06 16:19 ` redi at gcc dot gnu.org
  2020-07-06 16:20 ` ian.s.mcinerney at ieee dot org
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-06 16:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
What I meant was that I was tempted to disable them completely *even with*
-Wsystem-headers. All warnings are already disabled by default in libstdc++
headers. If your build is adding -Wsystem-headers then that's the problem.
Don't do that, and you won't get so much noise.

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

* [Bug libstdc++/96063] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
                   ` (3 preceding siblings ...)
  2020-07-06 16:19 ` redi at gcc dot gnu.org
@ 2020-07-06 16:20 ` ian.s.mcinerney at ieee dot org
  2020-07-06 16:21 ` ian.s.mcinerney at ieee dot org
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: ian.s.mcinerney at ieee dot org @ 2020-07-06 16:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

--- Comment #5 from Ian McInerney <ian.s.mcinerney at ieee dot org> ---
Created attachment 48837
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48837&action=edit
test program

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

* [Bug libstdc++/96063] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
                   ` (4 preceding siblings ...)
  2020-07-06 16:20 ` ian.s.mcinerney at ieee dot org
@ 2020-07-06 16:21 ` ian.s.mcinerney at ieee dot org
  2020-07-06 16:27 ` [Bug c++/96063] [10/11 Regression] " redi at gcc dot gnu.org
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: ian.s.mcinerney at ieee dot org @ 2020-07-06 16:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

--- Comment #6 from Ian McInerney <ian.s.mcinerney at ieee dot org> ---
They are showing up when I don't have -Wsystem-headers passed in on the command
line. Compiling the attached test program with `g++ -Wmismatched-tags main.cpp`
shows the warnings. All that is doing is including basically all public library
headers.

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

* [Bug c++/96063] [10/11 Regression] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
                   ` (5 preceding siblings ...)
  2020-07-06 16:21 ` ian.s.mcinerney at ieee dot org
@ 2020-07-06 16:27 ` redi at gcc dot gnu.org
  2020-07-06 16:34 ` redi at gcc dot gnu.org
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-06 16:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
          Component|libstdc++                   |c++
            Summary|mismatched-tags warnings in |[10/11 Regression]
                   |stdlib headers              |mismatched-tags warnings in
                   |                            |stdlib headers
      Known to fail|                            |10.1.0, 11.0
   Target Milestone|11.0                        |10.2
         Resolution|FIXED                       |---
      Known to work|                            |9.3.0
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Gah, that's a compiler bug.

Martin, the -Wmismatched-tags warning adds loads of notes which are printed
unconditionally when -Wmismatched-tags is used. They need to be gated on
whether the actual warning is printed, so that you don't get orphaned notes for
warnings that are suppressed due to occurring in system headers.

I've changed the libstdc++ headers on trunk, but not on gcc-10, so you can
still reproduce it easily on that branch.

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

* [Bug c++/96063] [10/11 Regression] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
                   ` (6 preceding siblings ...)
  2020-07-06 16:27 ` [Bug c++/96063] [10/11 Regression] " redi at gcc dot gnu.org
@ 2020-07-06 16:34 ` redi at gcc dot gnu.org
  2020-07-06 19:42 ` msebor at gcc dot gnu.org
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-06 16:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Created attachment 48838
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48838&action=edit
Fix orphaned notes.

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

* [Bug c++/96063] [10/11 Regression] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
                   ` (7 preceding siblings ...)
  2020-07-06 16:34 ` redi at gcc dot gnu.org
@ 2020-07-06 19:42 ` msebor at gcc dot gnu.org
  2020-07-07  7:28 ` redi at gcc dot gnu.org
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-07-06 19:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org
             Status|REOPENED                    |ASSIGNED

--- Comment #9 from Martin Sebor <msebor at gcc dot gnu.org> ---
The warning routine checks the warning state and returns without doing anything
when it's set:

  if (!warn_mismatched_tags)
    return;

It then calls warning_at() assuming the calls necessarily succeed, and doesn't
check their return value before calling inform().  That only works for global
settings of the warnings but not for local overrides via #pragmas.  Let me fix
it.  Longer term, we need a functional API to query whether warnings are
enabled, one that takes their context into consideration.  Checking the global
variable is almost never right.

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

* [Bug c++/96063] [10/11 Regression] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
                   ` (8 preceding siblings ...)
  2020-07-06 19:42 ` msebor at gcc dot gnu.org
@ 2020-07-07  7:28 ` redi at gcc dot gnu.org
  2020-07-07 16:46 ` msebor at gcc dot gnu.org
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-07  7:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
What's wrong with checking the return value of warning_at as in the patch in
comment 8?

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

* [Bug c++/96063] [10/11 Regression] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
                   ` (9 preceding siblings ...)
  2020-07-07  7:28 ` redi at gcc dot gnu.org
@ 2020-07-07 16:46 ` msebor at gcc dot gnu.org
  2020-07-07 17:24 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-07-07 16:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

Martin Sebor <msebor at gcc dot gnu.org> changed:

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

--- Comment #11 from Martin Sebor <msebor at gcc dot gnu.org> ---
Checking the return value is good -- it's also what I did in the patch I
submitted yesterday:
https://gcc.gnu.org/pipermail/gcc-patches/2020-July/549476.html (I had
overlooked your patch in comment #8.)  What I was saying is that taking the
value of a warn_xxx variable as an indication of thew result of a warning()
call is wrong because the former doesn't reflect all the machinations the
warning() call goes through to decide whether or not to issue a warning.

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

* [Bug c++/96063] [10/11 Regression] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
                   ` (10 preceding siblings ...)
  2020-07-07 16:46 ` msebor at gcc dot gnu.org
@ 2020-07-07 17:24 ` cvs-commit at gcc dot gnu.org
  2020-07-07 17:31 ` msebor at gcc dot gnu.org
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-07 17:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>:

https://gcc.gnu.org/g:6f9c9ea40a1e937ea1b549625cf7762d4a8a2078

commit r11-1899-g6f9c9ea40a1e937ea1b549625cf7762d4a8a2078
Author: Martin Sebor <msebor@redhat.com>
Date:   Tue Jul 7 11:23:50 2020 -0600

    Avoid printing informational notes when -Wmismatched-tags is suppressed in
system headers (PR c++/96063)

    Related:
    PR c++/96063 - mismatched-tags warnings in stdlib headers

    gcc/cp/ChangeLog:

            PR c++/96063
            * parser.c (class_decl_loc_t::diag_mismatched_tags): Print notes
only
            if warning_at returns nonzero.

    gcc/testsuite/ChangeLog:

            PR c++/96063
            * g++.dg/warn/Wmismatched-tags-7.C: New test.
            * g++.dg/warn/Wmismatched-tags-8.C: New test.

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

* [Bug c++/96063] [10/11 Regression] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
                   ` (11 preceding siblings ...)
  2020-07-07 17:24 ` cvs-commit at gcc dot gnu.org
@ 2020-07-07 17:31 ` msebor at gcc dot gnu.org
  2020-07-08  1:24 ` ian.s.mcinerney at ieee dot org
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-07-07 17:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

--- Comment #13 from Martin Sebor <msebor at gcc dot gnu.org> ---
Jon, is there anything else to do here or can we resolve this as fixed?

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

* [Bug c++/96063] [10/11 Regression] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
                   ` (12 preceding siblings ...)
  2020-07-07 17:31 ` msebor at gcc dot gnu.org
@ 2020-07-08  1:24 ` ian.s.mcinerney at ieee dot org
  2020-07-13  9:15 ` ian.s.mcinerney at ieee dot org
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: ian.s.mcinerney at ieee dot org @ 2020-07-08  1:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

--- Comment #14 from Ian McInerney <ian.s.mcinerney at ieee dot org> ---
Is it possible to backport this to the GCC 10 branch? The printing of these
notes makes this warning almost impossible to use on any large project that
uses the standard library.

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

* [Bug c++/96063] [10/11 Regression] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
                   ` (13 preceding siblings ...)
  2020-07-08  1:24 ` ian.s.mcinerney at ieee dot org
@ 2020-07-13  9:15 ` ian.s.mcinerney at ieee dot org
  2020-07-13  9:57 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: ian.s.mcinerney at ieee dot org @ 2020-07-13  9:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

--- Comment #15 from Ian McInerney <ian.s.mcinerney at ieee dot org> ---
Martin, can you backport you compiler patch to the GCC10 branch so it is fixed
there as well? As I said, this makes the warning essentially useless to use on
large codebases with the current release.

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

* [Bug c++/96063] [10/11 Regression] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
                   ` (14 preceding siblings ...)
  2020-07-13  9:15 ` ian.s.mcinerney at ieee dot org
@ 2020-07-13  9:57 ` redi at gcc dot gnu.org
  2020-07-13 12:59 ` ian.s.mcinerney at ieee dot org
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-13  9:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

--- Comment #16 from Jonathan Wakely <redi at gcc dot gnu.org> ---
One or both of r11-1853 and r11-1899 should be backported.

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

* [Bug c++/96063] [10/11 Regression] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
                   ` (15 preceding siblings ...)
  2020-07-13  9:57 ` redi at gcc dot gnu.org
@ 2020-07-13 12:59 ` ian.s.mcinerney at ieee dot org
  2020-07-13 15:34 ` cvs-commit at gcc dot gnu.org
  2020-07-13 15:36 ` [Bug c++/96063] [10 " msebor at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: ian.s.mcinerney at ieee dot org @ 2020-07-13 12:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

--- Comment #17 from Ian McInerney <ian.s.mcinerney at ieee dot org> ---
I think that r11-1899 is the more important one to backport, since that will
also allow for warnings that are generated by headers inside "-isystem" include
directories to not have the notes printed without the warning.

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

* [Bug c++/96063] [10/11 Regression] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
                   ` (16 preceding siblings ...)
  2020-07-13 12:59 ` ian.s.mcinerney at ieee dot org
@ 2020-07-13 15:34 ` cvs-commit at gcc dot gnu.org
  2020-07-13 15:36 ` [Bug c++/96063] [10 " msebor at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-13 15:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

--- Comment #18 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Martin Sebor
<msebor@gcc.gnu.org>:

https://gcc.gnu.org/g:5e4c9ebbab7bec3b5994f85aebce13bf37cf46e9

commit r10-8471-g5e4c9ebbab7bec3b5994f85aebce13bf37cf46e9
Author: Martin Sebor <msebor@redhat.com>
Date:   Mon Jul 13 09:32:40 2020 -0600

    Avoid printing informational notes when -Wmismatched-tags is suppressed in
system headers (PR c++/96063)

    Related:
    PR c++/96063 - mismatched-tags warnings in stdlib headers

    gcc/cp/ChangeLog:

            PR c++/96063
            * parser.c (class_decl_loc_t::diag_mismatched_tags): Print notes
only
            if warning_at returns nonzero.

    gcc/testsuite/ChangeLog:

            PR c++/96063
            * g++.dg/warn/Wmismatched-tags-7.C: New test.
            * g++.dg/warn/Wmismatched-tags-8.C: New test.

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

* [Bug c++/96063] [10 Regression] mismatched-tags warnings in stdlib headers
  2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
                   ` (17 preceding siblings ...)
  2020-07-13 15:34 ` cvs-commit at gcc dot gnu.org
@ 2020-07-13 15:36 ` msebor at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-07-13 15:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96063

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|11.0                        |
         Resolution|---                         |FIXED
            Summary|[10/11 Regression]          |[10 Regression]
                   |mismatched-tags warnings in |mismatched-tags warnings in
                   |stdlib headers              |stdlib headers
             Status|ASSIGNED                    |RESOLVED

--- Comment #19 from Martin Sebor <msebor at gcc dot gnu.org> ---
I backported the front end fix in r10-8471.

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

end of thread, other threads:[~2020-07-13 15:36 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-05  0:41 [Bug libstdc++/96063] New: mismatched-tags warnings in stdlib headers ian.s.mcinerney at ieee dot org
2020-07-06 11:45 ` [Bug libstdc++/96063] " redi at gcc dot gnu.org
2020-07-06 16:01 ` ian.s.mcinerney at ieee dot org
2020-07-06 16:15 ` redi at gcc dot gnu.org
2020-07-06 16:19 ` redi at gcc dot gnu.org
2020-07-06 16:20 ` ian.s.mcinerney at ieee dot org
2020-07-06 16:21 ` ian.s.mcinerney at ieee dot org
2020-07-06 16:27 ` [Bug c++/96063] [10/11 Regression] " redi at gcc dot gnu.org
2020-07-06 16:34 ` redi at gcc dot gnu.org
2020-07-06 19:42 ` msebor at gcc dot gnu.org
2020-07-07  7:28 ` redi at gcc dot gnu.org
2020-07-07 16:46 ` msebor at gcc dot gnu.org
2020-07-07 17:24 ` cvs-commit at gcc dot gnu.org
2020-07-07 17:31 ` msebor at gcc dot gnu.org
2020-07-08  1:24 ` ian.s.mcinerney at ieee dot org
2020-07-13  9:15 ` ian.s.mcinerney at ieee dot org
2020-07-13  9:57 ` redi at gcc dot gnu.org
2020-07-13 12:59 ` ian.s.mcinerney at ieee dot org
2020-07-13 15:34 ` cvs-commit at gcc dot gnu.org
2020-07-13 15:36 ` [Bug c++/96063] [10 " msebor at gcc dot gnu.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).