Merge pull request #60 from xorgy/no-define-defined
Preprocessor: 'defined' cannot be used as a macro name in #define or #undef.
This commit is contained in:
		
						commit
						68e1c454da
					
				
							
								
								
									
										4
									
								
								Test/baseResults/preprocessor.defined.vert.err
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								Test/baseResults/preprocessor.defined.vert.err
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					ERROR: 0:2: '#define' : "defined" can't be (un)defined: defined
 | 
				
			||||||
 | 
					ERROR: 1 compilation errors.  No code generated.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										0
									
								
								Test/baseResults/preprocessor.defined.vert.out
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								Test/baseResults/preprocessor.defined.vert.out
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										2
									
								
								Test/preprocessor.defined.vert
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								Test/preprocessor.defined.vert
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					#define defined_not_really
 | 
				
			||||||
 | 
					#define defined // ERROR: "defined" can't be (un)defined:
 | 
				
			||||||
@ -11,3 +11,4 @@ preprocessor.line.frag
 | 
				
			|||||||
preprocessor.pragma.vert
 | 
					preprocessor.pragma.vert
 | 
				
			||||||
preprocessor.simple.vert
 | 
					preprocessor.simple.vert
 | 
				
			||||||
preprocessor.success_if_parse_would_fail.vert
 | 
					preprocessor.success_if_parse_would_fail.vert
 | 
				
			||||||
 | 
					preprocessor.defined.vert
 | 
				
			||||||
 | 
				
			|||||||
@ -2063,6 +2063,8 @@ void TParseContext::reservedPpErrorCheck(const TSourceLoc& loc, const char* iden
 | 
				
			|||||||
    // however, before that, ES tests required an error.
 | 
					    // however, before that, ES tests required an error.
 | 
				
			||||||
    if (strncmp(identifier, "GL_", 3) == 0)
 | 
					    if (strncmp(identifier, "GL_", 3) == 0)
 | 
				
			||||||
        ppError(loc, "names beginning with \"GL_\" can't be (un)defined:", op,  identifier);
 | 
					        ppError(loc, "names beginning with \"GL_\" can't be (un)defined:", op,  identifier);
 | 
				
			||||||
 | 
					    else if (strncmp(identifier, "defined", 8) == 0)
 | 
				
			||||||
 | 
					        ppError(loc, "\"defined\" can't be (un)defined:", op,  identifier);
 | 
				
			||||||
    else if (strstr(identifier, "__") != 0) {
 | 
					    else if (strstr(identifier, "__") != 0) {
 | 
				
			||||||
        if (profile == EEsProfile && version >= 300 &&
 | 
					        if (profile == EEsProfile && version >= 300 &&
 | 
				
			||||||
            (strcmp(identifier, "__LINE__") == 0 ||
 | 
					            (strcmp(identifier, "__LINE__") == 0 ||
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user