summarylogtreecommitdiffstats
path: root/0037-Fix-include-after-macro-expansion.patch
blob: 0e446cbfe6ee8eca66a55fbcf20800520f336ae3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
From: Sergei Litvin <litvindev@gmail.com>
Date: Fri Nov  3 12:32:28 AM CET 2023
Subject: Fix include <> after macro expansion


*** a/src/yylex.c	2023-11-03 00:28:16.546067621 +0100
--- b/src/yylex.c	2023-11-02 23:33:53.413480826 +0100
***************
*** 559,564 ****
--- 559,565 ----
  	FILE *nyyin;
  	char *fname;
  	char *ccc, *cc2;
+ 	char fn[MAX_FILE_NAME_SIZE];
  	int lex,l,h,v,len;
  	S_position pos;
  	GetLexA(lex, cc2);
***************
*** 576,589 ****
  		cInput.cc = cc2;		/* unget lexem */
  		lex = yylex();
  		if (lex == STRING_LITERAL) {
! 			cInput = macStack[0];		// hack, cut everything pending
! 			macStacki = 0;
  			processInclude2(ipos, '\"', yytext, nextFlag);
  		} else if (lex == '<') {
! 			// TODO!!!!
! 			warning(ERR_ST,"Include <> after macro expansion not yet implemented, sorry\n\tuse \"\" instead");
  		}
- 		//do lex = yylex(); while (lex != '\n');
  	}
  	return;
   endOfMacArg:	assert(0);
--- 577,603 ----
  		cInput.cc = cc2;		/* unget lexem */
  		lex = yylex();
  		if (lex == STRING_LITERAL) {
! 			if (macStacki != 0) {
! 				cInput = macStack[0];		// hack, cut everything pending
! 				macStacki = 0;
! 			}
  			processInclude2(ipos, '\"', yytext, nextFlag);
  		} else if (lex == '<') {
! 			ccc = fn;
! 			lex = yylex();
! 			while (lex != '>' && lex != '\n' && lex != 0) {
! 				strcpy(ccc, yytext);
! 				ccc += strlen(ccc);
! 				lex = yylex();
! 			}
! 			if (ccc != fn) {
! 				if (macStacki != 0) {
! 					cInput = macStack[0];		// hack, cut everything pending
! 					macStacki = 0;
! 				}
! 				processInclude2(ipos, '<', fn, nextFlag);
! 			}
  		}
  	}
  	return;
   endOfMacArg:	assert(0);