Preprocessor directives can now appear in the argument list of function-like macro calls.
#pragma PP-tokens can now be macro replaced. #include header names directly enclosed in <> are free of macro replacement. Preprocess-only mode (-E) now outputs with #line as source info. Moved testcases for #760 and #1357. Added testcase for #1643.
This commit is contained in:
30
test/val/bug1357.c
Normal file
30
test/val/bug1357.c
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
/* issue #1357 - X Macros don't work with C preprocessor */
|
||||
|
||||
#define OPCODES(X) \
|
||||
X(PUSHNIL) \
|
||||
X(PUSHTRUE) \
|
||||
X(PUSHFALSE)
|
||||
|
||||
enum {
|
||||
#define X(op) op,
|
||||
OPCODES(X)
|
||||
#undef X
|
||||
N_OPS
|
||||
};
|
||||
|
||||
/* cc65 -E bug1357.c -o bug1357.c.pre
|
||||
should produce something like this:
|
||||
|
||||
enum {
|
||||
PUSHNIL,
|
||||
PUSHTRUE,
|
||||
PUSHFALSE,
|
||||
N_OPS
|
||||
};
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
12
test/val/bug1643.c
Normal file
12
test/val/bug1643.c
Normal file
@@ -0,0 +1,12 @@
|
||||
/* bug #1643, macro expansion in #include */
|
||||
|
||||
#define MKSTR(a) MKSTR_IMPL(a)
|
||||
#define MKSTR_IMPL(a) #a
|
||||
#define BUG1643_H bug1643.h
|
||||
|
||||
#include MKSTR(BUG1643_H)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return BUG1643_RESULT;
|
||||
}
|
||||
13
test/val/bug1643.h
Normal file
13
test/val/bug1643.h
Normal file
@@ -0,0 +1,13 @@
|
||||
/* bug #1643, macro expansion in #include */
|
||||
|
||||
#define STDIO_H <stdio.h>
|
||||
#include STDIO_H
|
||||
|
||||
#ifdef string
|
||||
#undef string
|
||||
#endif
|
||||
|
||||
#define string 0!%^&*/_=
|
||||
#include <string.h>
|
||||
|
||||
#define BUG1643_RESULT 0
|
||||
12
test/val/bug760.c
Normal file
12
test/val/bug760.c
Normal file
@@ -0,0 +1,12 @@
|
||||
/* bug#760 - Error when using macros as pragma arguments */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define BANK "PRG0"
|
||||
|
||||
#pragma rodata-name(push, BANK)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user