Separated C preprocessor errors from other errors.
This commit is contained in:
@@ -63,7 +63,8 @@ CUSTOMSOURCES = \
|
||||
# exact error output is required
|
||||
ERRORSOURCES = \
|
||||
custom-reference-error.c \
|
||||
bug1889-missing-identifier.c
|
||||
bug1889-missing-identifier.c \
|
||||
bug2312-preprocessor-error.c
|
||||
|
||||
SOURCES := $(filter-out $(CUSTOMSOURCES) $(ERRORSOURCES),$(wildcard *.c))
|
||||
|
||||
|
||||
8
test/ref/bug2312-preprocessor-error.c
Normal file
8
test/ref/bug2312-preprocessor-error.c
Normal file
@@ -0,0 +1,8 @@
|
||||
/* Bug #2312 - Error recovery from preprocessor errors at the end of a declaration */
|
||||
|
||||
typedef int A; /* ';' consumption triggers PP below */
|
||||
|
||||
#define /* PP error during ';' consumption */
|
||||
|
||||
A f(void); /* Should be OK */
|
||||
int A(void); /* Should be an error */
|
||||
2
test/ref/bug2312-preprocessor-error.cref
Normal file
2
test/ref/bug2312-preprocessor-error.cref
Normal file
@@ -0,0 +1,2 @@
|
||||
bug2312-preprocessor-error.c:5: Error: Missing macro name
|
||||
bug2312-preprocessor-error.c:8: Error: Redefinition of typedef 'A' as different kind of symbol
|
||||
@@ -13,7 +13,10 @@
|
||||
and then "make" again to confirm
|
||||
*/
|
||||
|
||||
short main(int argc, char* argv[])
|
||||
typedef short return_t;
|
||||
#error /* produce an error */
|
||||
|
||||
return_t main(int argc, char* argv[])
|
||||
{
|
||||
printf("%02x", 0x42); /* produce an error */
|
||||
n = 0; /* produce an error */
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
custom-reference-error.c:18: Error: Call to undeclared function 'printf'
|
||||
custom-reference-error.c:19: Error: Undeclared identifier 'n'
|
||||
custom-reference-error.c:21: Warning: Control reaches end of non-void function [-Wreturn-type]
|
||||
custom-reference-error.c:21: Warning: Parameter 'argc' is never used
|
||||
custom-reference-error.c:21: Warning: Parameter 'argv' is never used
|
||||
custom-reference-error.c:17: Error: #error
|
||||
custom-reference-error.c:21: Error: Call to undeclared function 'printf'
|
||||
custom-reference-error.c:22: Error: Undeclared identifier 'n'
|
||||
custom-reference-error.c:24: Warning: Control reaches end of non-void function [-Wreturn-type]
|
||||
custom-reference-error.c:24: Warning: Parameter 'argc' is never used
|
||||
custom-reference-error.c:24: Warning: Parameter 'argv' is never used
|
||||
|
||||
Reference in New Issue
Block a user