public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/106267] New: #pragma GCC diagnostic ignored not preserved for a -Wattribute-alias warning
@ 2022-07-12 9:36 marxin at gcc dot gnu.org
2022-07-12 9:38 ` [Bug preprocessor/106267] " marxin at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-07-12 9:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106267
Bug ID: 106267
Summary: #pragma GCC diagnostic ignored not preserved for a
-Wattribute-alias warning
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
Target Milestone: ---
For the following code snippet isolated from Linux kernel the ignored
-Wattribute-alias is not preserved:
$ cat posix-stubs.c
#define __diag_GCC(version, severity, s)
\
__diag_GCC_##version(__diag_GCC_##severity s)
#define __diag_GCC_ignore ignored
#define __diag_str1(s) #s
#define __diag_str(s) __diag_str1(s)
#define __diag(s) _Pragma(__diag_str(GCC diagnostic s))
#define __diag_GCC_8(s) __diag(s)
#define __diag_pop() __diag(pop)
#define __diag_push() __diag(push)
#define __diag_ignore(compiler, version, option, comment)
\
__diag_##compiler(version, ignore, option)
#define SYSCALL_ALIAS_PROTO(a) \
__diag_push(); \
__diag_ignore(GCC, 8, "-Wattribute-alias", \
"Alias to nonimplemented syscall"); \
typeof(a) a __attribute__((alias("sys_ni_posix_timers"))); \
__diag_pop()
int sys_timer_create(int);
void sys_ni_posix_timers(void) {}
#define SYS_NI(name) SYSCALL_ALIAS_PROTO(sys_##name)
SYS_NI(timer_create)
$ gcc posix-stubs.c -c -Werror
posix-stubs.c:23:42: error: ‘sys_timer_create’ alias between functions of
incompatible types ‘int(int)’ and ‘void(void)’ [-Werror=attribute-alias=]
23 | #define SYS_NI(name) SYSCALL_ALIAS_PROTO(sys_##name)
| ^~~~
posix-stubs.c:17:19: note: in definition of macro ‘SYSCALL_ALIAS_PROTO’
17 | typeof(a) a __attribute__((alias("sys_ni_posix_timers"))); \
| ^
posix-stubs.c:24:1: note: in expansion of macro ‘SYS_NI’
24 | SYS_NI(timer_create)
| ^~~~~~
posix-stubs.c:21:6: note: aliased declaration here
21 | void sys_ni_posix_timers(void) {}
| ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
While using pre-processed input works correctly:
$ gcc posix-stubs.c -c -Werror -E > posix-stubs.i && gcc posix-stubs.i -c
-Werror
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug preprocessor/106267] #pragma GCC diagnostic ignored not preserved for a -Wattribute-alias warning
2022-07-12 9:36 [Bug preprocessor/106267] New: #pragma GCC diagnostic ignored not preserved for a -Wattribute-alias warning marxin at gcc dot gnu.org
@ 2022-07-12 9:38 ` marxin at gcc dot gnu.org
2022-07-12 9:45 ` marxin at gcc dot gnu.org
2022-07-12 9:47 ` marxin at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-07-12 9:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106267
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2022-07-12
Status|UNCONFIRMED |NEW
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug preprocessor/106267] #pragma GCC diagnostic ignored not preserved for a -Wattribute-alias warning
2022-07-12 9:36 [Bug preprocessor/106267] New: #pragma GCC diagnostic ignored not preserved for a -Wattribute-alias warning marxin at gcc dot gnu.org
2022-07-12 9:38 ` [Bug preprocessor/106267] " marxin at gcc dot gnu.org
@ 2022-07-12 9:45 ` marxin at gcc dot gnu.org
2022-07-12 9:47 ` marxin at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-07-12 9:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106267
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Simplified test-case:
#define SYSCALL_ALIAS_PROTO(a) \
_Pragma ("GCC diagnostic push"); \
_Pragma ("GCC diagnostic ignored \"-Wattribute-alias\""); \
typeof(a) a __attribute__((alias("sys_ni_posix_timers"))); \
_Pragma ("GCC diagnostic pop");
int sys_timer_create(int);
void sys_ni_posix_timers(void) {}
SYSCALL_ALIAS_PROTO(sys_timer_create)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug preprocessor/106267] #pragma GCC diagnostic ignored not preserved for a -Wattribute-alias warning
2022-07-12 9:36 [Bug preprocessor/106267] New: #pragma GCC diagnostic ignored not preserved for a -Wattribute-alias warning marxin at gcc dot gnu.org
2022-07-12 9:38 ` [Bug preprocessor/106267] " marxin at gcc dot gnu.org
2022-07-12 9:45 ` marxin at gcc dot gnu.org
@ 2022-07-12 9:47 ` marxin at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-07-12 9:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106267
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|NEW |RESOLVED
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Oh, it's fixed on master since r13-1596-g0587cef3d7962a8b.
*** This bug has been marked as a duplicate of bug 97498 ***
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-07-12 9:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-12 9:36 [Bug preprocessor/106267] New: #pragma GCC diagnostic ignored not preserved for a -Wattribute-alias warning marxin at gcc dot gnu.org
2022-07-12 9:38 ` [Bug preprocessor/106267] " marxin at gcc dot gnu.org
2022-07-12 9:45 ` marxin at gcc dot gnu.org
2022-07-12 9:47 ` marxin 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).