https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99315
Bug ID: 99315
Summary: #pragma GCC warning does not concatenate string
literals
Product: gcc
Version: 10.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
Assignee: unassigned at gcc dot gnu.org
Reporter: fweimer at redhat dot com
Target Milestone: ---
This:
#pragma GCC warning "foo" "bar"
#pragma GCC error "foo" "bar"
produces:
/tmp/t.c:1:21: warning: foo
1 | #pragma GCC warning "foo" "bar"
| ^~~~~
/tmp/t.c:2:19: error: foo
2 | #pragma GCC error "foo" "bar"
| ^~~~~
It is an oversight in the processing of the pragma arguments. Clang produces
this, which is closer to developer expectations:
/tmp/t.c:1:13: warning: foobar [-W#pragma-messages]
/tmp/t.c:2:13: error: foobar
(Another option would be to error out on multiple arguments to the pragma.)
This is not a regression, it's a bug that's always been present.