Fix regression parsing gcc preprocessor linemarkers
These are preprocessor statement in the form: # linenum filename flags Closes #1475
This commit is contained in:
parent
9038a9987d
commit
1f46d9b7b9
8 changed files with 70 additions and 1 deletions
|
|
@ -707,6 +707,7 @@ C_TEST_CASES += \
|
|||
preproc \
|
||||
preproc_constants_c \
|
||||
preproc_defined \
|
||||
preproc_gcc_output \
|
||||
preproc_include \
|
||||
preproc_line_file \
|
||||
register_par \
|
||||
|
|
|
|||
14
Examples/test-suite/errors/pp_unknowndirective3.i
Normal file
14
Examples/test-suite/errors/pp_unknowndirective3.i
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
%module xxx
|
||||
|
||||
// Testing is_digits detecting gcc linemarkers
|
||||
|
||||
// These are valid
|
||||
# 1 "/usr/include/stdc-predef.h" 1 3 4
|
||||
# 123 "header1.h"
|
||||
|
||||
// These are invalid
|
||||
#a1 'a.h'
|
||||
#1b 'b.h'
|
||||
#1c1 'c.h'
|
||||
#d1d 'd.h'
|
||||
|
||||
4
Examples/test-suite/errors/pp_unknowndirective3.stderr
Normal file
4
Examples/test-suite/errors/pp_unknowndirective3.stderr
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
pp_unknowndirective3.i:10: Error: Unknown SWIG preprocessor directive: a1 (if this is a block of target language code, delimit it with %{ and %})
|
||||
pp_unknowndirective3.i:11: Error: Unknown SWIG preprocessor directive: 1b (if this is a block of target language code, delimit it with %{ and %})
|
||||
pp_unknowndirective3.i:12: Error: Unknown SWIG preprocessor directive: 1c1 (if this is a block of target language code, delimit it with %{ and %})
|
||||
pp_unknowndirective3.i:13: Error: Unknown SWIG preprocessor directive: d1d (if this is a block of target language code, delimit it with %{ and %})
|
||||
13
Examples/test-suite/preproc_gcc_output.h
Normal file
13
Examples/test-suite/preproc_gcc_output.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# 1 "header1.h"
|
||||
# 1 "<built-in>"
|
||||
# 1 "<command-line>"
|
||||
# 1 "/usr/include/stdc-predef.h" 1 3 4
|
||||
# 1 "<command-line>" 2
|
||||
# 1 "header1.h"
|
||||
# 18 "header1.h"
|
||||
void header1_function_a(int a);
|
||||
# 1 "header2.h" 1
|
||||
# 13 "header2.h"
|
||||
void header2_function(int x);
|
||||
# 20 "header1.h" 2
|
||||
void header1_function_b(int b);
|
||||
12
Examples/test-suite/preproc_gcc_output.i
Normal file
12
Examples/test-suite/preproc_gcc_output.i
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
%module preproc_gcc_output
|
||||
// Testcase for Github issue #1475 using the output of gcc -E
|
||||
|
||||
// The file below was generated using 'gcc -E header1.h'
|
||||
// where header1.h included header2.h
|
||||
%include "preproc_gcc_output.h"
|
||||
|
||||
%{
|
||||
void header1_function_a(int a) {}
|
||||
void header2_function(int x) {}
|
||||
void header1_function_b(int b) {}
|
||||
%}
|
||||
5
Examples/test-suite/python/preproc_gcc_output_runme.py
Normal file
5
Examples/test-suite/python/preproc_gcc_output_runme.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import preproc_gcc_output
|
||||
|
||||
preproc_gcc_output.header1_function_a(99)
|
||||
preproc_gcc_output.header1_function_b(99)
|
||||
preproc_gcc_output.header2_function(99)
|
||||
Loading…
Add table
Add a link
Reference in a new issue