This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Macro causes an error
- From: "Ben. K." <bkausbk at web dot de>
- To: <gcc at gcc dot gnu dot org>
- Date: Thu, 18 Apr 2002 05:26:49 +0200
- Subject: Macro causes an error
I've declared some macros, but it want not work, don't
know why. The preprocessor produces correct code.
Im using gcc version 3.1 20020415 (prerelease).
------ macros <handler.h>:
#define OUTPUTARGS(...) :__VA_ARGS__
#define INPUTARGS(...) :__VA_ARGS__
#define CLOBBEREDARGS(...) :__VA_ARGS__
#define START(x) asm("\t.text\n"\
"\t.align 2\n" \
".globl _" x "\n" \
"_" x ":\n"
#define END(x,y, ...) x y "\n" __VA_ARGS__);
#define INT "\tiret "
---- gcc code:
START("PAGE_FAULT_HANDLER")
"\tmov eax,1\n"
END(INT,"4",OUTPUTARGS("=r"(a)))
Compiler output: 6: parse error before ':' token
---- cpp produces:
# 1 "E:/OS/aos/source/kernel/test2.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "E:/OS/aos/source/kernel/test2.c"
# 1 "E:/OS/aos/source/kernel/handler.h" 1
# 2 "E:/OS/aos/source/kernel/test2.c" 2
int a;
asm("\t.text\n" "\t.align 2\n" ".globl _" "PAGE_FAULT_HANDLER" "\n"
"_" "PAGE_FAULT_HANDLER" ":\n"
"\tmov eax,1\n"
"\tiret " "4" "\n" :"=r"(a));
----
What is the problem here?
regards
Benjamin