public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/103869] New: better diagnostics surrounding uses of -fms-extensions
@ 2021-12-30 19:57 egallager at gcc dot gnu.org
2021-12-30 21:53 ` [Bug c++/103869] " pinskia at gcc dot gnu.org
2023-02-01 18:40 ` jason at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: egallager at gcc dot gnu.org @ 2021-12-30 19:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103869
Bug ID: 103869
Summary: better diagnostics surrounding uses of -fms-extensions
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: diagnostic, documentation
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: egallager at gcc dot gnu.org
Target Milestone: ---
I am putting this under the "C" component because the option is documented
under the list of C Dialect Options:
https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#C-Dialect-Options
However, it could also be considered a C++ bug as per bug 71283.
Let's start with the example code provided for the option:
$ cat ms-extensions.c
typedef int UOW;
struct ABC {
UOW UOW;
};
$
The manual says, "In C++ code, this allows member names in structures to be
similar to previous types declarations." However, when compiling with the C
front-end, -Wc++-compat doesn't say anything about -fms-extensions allowing it,
nor does explicitly providing -fms-extensions silence it:
$ /usr/local/bin/gcc -c -Wall -Wextra -pedantic -Wshadow -Wc++-compat
ms-extensions.c
ms-extensions.c:3:7: warning: using 'UOW' as both field and typedef name is
invalid in C++ [-Wc++-compat]
3 | UOW UOW;
| ^~~
$ /usr/local/bin/gcc -c -Wall -Wextra -pedantic -Wshadow -Wc++-compat
-fms-extensions ms-extensions.c
ms-extensions.c:3:7: warning: using 'UOW' as both field and typedef name is
invalid in C++ [-Wc++-compat]
3 | UOW UOW;
| ^~~
$
Meanwhile, with the C++ front-end, the error message only notes -fpermissive as
a way to allow it, but not -fms-extensions:
$ /usr/local/bin/g++ -c -Wall -Wextra -pedantic -Wshadow ms-extensions.c
ms-extensions.c:3:7: error: declaration of 'UOW ABC::UOW' changes meaning of
'UOW' [-fpermissive]
3 | UOW UOW;
| ^~~
ms-extensions.c:1:13: note: 'UOW' declared here as 'typedef int UOW'
1 | typedef int UOW;
| ^~~
$
-fpermissive turns the error into a warning, but providing -fms-extensions
removes even the warning:
$ /usr/local/bin/g++ -c -Wall -Wextra -pedantic -Wshadow -fpermissive
ms-extensions.c
ms-extensions.c:3:7: warning: declaration of 'UOW ABC::UOW' changes meaning of
'UOW' [-fpermissive]
3 | UOW UOW;
| ^~~
ms-extensions.c:1:13: note: 'UOW' declared here as 'typedef int UOW'
1 | typedef int UOW;
| ^~~
$ /usr/local/bin/g++ -c -Wall -Wextra -pedantic -Wshadow -fpermissive
-fms-extensions ms-extensions.c
$ /usr/local/bin/g++ -c -Wall -Wextra -pedantic -Wshadow -fms-extensions
ms-extensions.c
$
IMO there should be a separate pedwarn even with -fms-extensions controlled by
a separate -Wms-extensions to complain in the -pedantic -fms-extensions case,
which could then be disabled with -pedantic -fms-extensions -Wno-ms-extensions
(or just -Wno-pedantic), e.g.:
$ /usr/local/bin/g++ -c -Wall -Wextra -pedantic -Wshadow -fms-extensions
ms-extensions.c
ms-extensions.c:3:7: warning: declaration of 'UOW ABC::UOW' is only being
allowed due to -fms-extensions [-Wms-extensions]
3 | UOW UOW;
| ^~~
ms-extensions.c:1:13: note: 'UOW' declared here as 'typedef int UOW'
1 | typedef int UOW;
| ^~~
$
Alternatively, the additional complaint could come from -Wshadow instead.
Anyways, there are lots of possibilities here; let's try to come up with a
consensus as to what would work best.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/103869] better diagnostics surrounding uses of -fms-extensions
2021-12-30 19:57 [Bug c/103869] New: better diagnostics surrounding uses of -fms-extensions egallager at gcc dot gnu.org
@ 2021-12-30 21:53 ` pinskia at gcc dot gnu.org
2023-02-01 18:40 ` jason at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-30 21:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103869
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c |c++
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/103869] better diagnostics surrounding uses of -fms-extensions
2021-12-30 19:57 [Bug c/103869] New: better diagnostics surrounding uses of -fms-extensions egallager at gcc dot gnu.org
2021-12-30 21:53 ` [Bug c++/103869] " pinskia at gcc dot gnu.org
@ 2023-02-01 18:40 ` jason at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: jason at gcc dot gnu.org @ 2023-02-01 18:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103869
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> ---
r13-5616 adds -W{no-,}changes-meaning to control this diagnostic specifically.
But -fms-extensions takes priority.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-01 18:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-30 19:57 [Bug c/103869] New: better diagnostics surrounding uses of -fms-extensions egallager at gcc dot gnu.org
2021-12-30 21:53 ` [Bug c++/103869] " pinskia at gcc dot gnu.org
2023-02-01 18:40 ` jason 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).