* gcc's error description for missing MACRO arguments is wrong.
@ 2021-11-05 0:59 Roy Qu
2021-11-05 7:25 ` Jonathan Wakely
0 siblings, 1 reply; 2+ messages in thread
From: Roy Qu @ 2021-11-05 0:59 UTC (permalink / raw)
To: gcc
Version: GCC 11.2 (msys2 mingw-w64 X86_64)
When a macro have more than one arguments, and u call it with no argument,
gcc will compliant with " only 1 given" instead of " 0 given"
Demo code:
#define TEST(x,y) test(x,y)
int main() {
int x=TEST();
}:
Error message:
F:/test.cpp:4:20: error: macro "TEST" requires *2* arguments, but only *1*
given
4 | int x=TEST();
| ^
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: gcc's error description for missing MACRO arguments is wrong.
2021-11-05 0:59 gcc's error description for missing MACRO arguments is wrong Roy Qu
@ 2021-11-05 7:25 ` Jonathan Wakely
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2021-11-05 7:25 UTC (permalink / raw)
To: Roy Qu; +Cc: gcc
On Fri, 5 Nov 2021, 01:00 Roy Qu via Gcc, <gcc@gcc.gnu.org> wrote:
> Version: GCC 11.2 (msys2 mingw-w64 X86_64)
> When a macro have more than one arguments, and u call it with no argument,
> gcc will compliant with " only 1 given" instead of " 0 given"
>
> Demo code:
>
> #define TEST(x,y) test(x,y)
> int main() {
> int x=TEST();
> }:
>
> Error message:
> F:/test.cpp:4:20: error: macro "TEST" requires *2* arguments, but only *1*
> given
>
> 4 | int x=TEST();
>
> | ^
>
No, you called it with one argument. An empty token sequence is a valid
macro argument. TEST(,) would be two arguments.
N.B. this is the wrong mailing list. If you want to ask about using GCC you
should use the gcc-help list, or to report bugs you should use the bugzilla
database.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-05 7:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05 0:59 gcc's error description for missing MACRO arguments is wrong Roy Qu
2021-11-05 7:25 ` Jonathan Wakely
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).