https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119438
Bug ID: 119438 Summary: More descriptive warning desired: '#' is not followed by a macro parameter Product: gcc Version: 14.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor Assignee: unassigned at gcc dot gnu.org Reporter: nightstrike at gmail dot com Target Milestone: --- ``` a.c: #define F(A) \ f(#notA) $ gcc -c a.c a.c:1:12: error: '#' is not followed by a macro parameter 1 | #define F(A) \ | ^ Compiler returned: 1 ``` This would ideally tell me at a minimum which parameter is misused, something like "notA is not a valid macro parameter". Ideally, though, it would point to the exact problem location. I spent a bit of time tracking this down in more complicated legacy environment with giant function-like macros, and it was pretty confusing. I guess this is mostly hampered due to the use of a multi-line macro, but the following isn't much better: ``` a.c:1:12: error: '#' is not followed by a macro parameter 1 | #define F(A) f(#notA) | ^ Compiler returned: 1 ``` You can imagine that this doesn't scale too well. It's easy to spot the problem here, but not with a large macro with half a dozen arguments. And yes, I admit that the best answer is, don't use complex macros. But, legacy code and all...