PP: Recognize <> style #include header names. I.e., #include <header-name>.

Also correctly test and handle missing newline.
This commit is contained in:
John Kessenich
2017-01-02 20:12:08 -07:00
parent faa720f14c
commit affc26674d
8 changed files with 105 additions and 44 deletions

View File

@@ -1,13 +1,13 @@
ERROR: 0:8000: '#include' : required extension not requested: GL_GOOGLE_include_directive
ERROR: 0:8000: '#include' : must be followed by a file designation
ERROR: 0:8000: '#include' : must be followed by a header name
ERROR: 0:8001: '#include' : required extension not requested: GL_GOOGLE_include_directive
ERROR: 0:8001: '#include' : must be followed by a file designation
ERROR: 0:8001: '#include' : must be followed by a header name
ERROR: 0:8002: '#include' : required extension not requested: GL_GOOGLE_include_directive
ERROR: 0:8002: '#include' : unexpected include directive
ERROR: 0:8003: '#include' : required extension not requested: GL_GOOGLE_include_directive
ERROR: 0:8003: '#include' : extra content after file designation
ERROR: 0:8003: '#include' : extra content after header name
ERROR: 0:8004: '#include' : required extension not requested: GL_GOOGLE_include_directive
ERROR: 0:8004: '#include' : unexpected include directive
ERROR: 0:8004: '#include' : expected newline
ERROR: 10 compilation errors. No code generated.

View File

@@ -1,8 +1,13 @@
ERROR: 0:8000: '#include' : must be followed by a file designation
ERROR: 0:8001: '#include' : must be followed by a file designation
ERROR: 0:8000: '#include' : must be followed by a header name
ERROR: 0:8001: '#include' : must be followed by a header name
ERROR: 0:8002: '#include' : unexpected include directive
ERROR: 0:8003: '#include' : extra content after file designation
ERROR: 0:8004: '#include' : unexpected include directive
ERROR: 5 compilation errors. No code generated.
ERROR: 0:8003: '#include' : unexpected include directive
ERROR: 0:8004: '#include' : extra content after header name
ERROR: 0:8005: '#include' : extra content after header name
ERROR: 0:8007: '#include' : unexpected include directive
ERROR: 0:8009: '' : header name too long
ERROR: 0:8009: '#include' : unexpected include directive
ERROR: 0:8010: '#include' : expected newline
ERROR: 10 compilation errors. No code generated.

View File

@@ -3,5 +3,4 @@
#include 123
#include "foo"
#include "foo" garbage
#include "no-eol"
#include "no-eol"

View File

@@ -3,5 +3,11 @@
#include
#include 123
#include "foo"
#include <foo>
#include "foo" garbage
#include "no-eol"
#include <foo> garbage
// max length
#include <ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789>
// too long
#include <ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF01234567890>
#include "no-eol"