Skip to content

Commit

Permalink
Merge pull request universal-ctags#3629 from masatake/cpreprocessor--…
Browse files Browse the repository at this point in the history
…dont-include-char-after-backslash-in-literals

CPreProcessor:  don't include the newline after a backslash in string or char literals
  • Loading branch information
masatake authored Jan 10, 2023
2 parents 9213292 + a674e97 commit a421b6c
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Units/parser-c.r/macrodef.d/expected.tags
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
INT input.c /^#define INT /;" d language:C file: macrodef:1
STR input.c /^#define STR /;" d language:C file: macrodef:"bar"
CHR input.c /^#define CHR /;" d language:C file: macrodef:''
CHR input.c /^#define CHR /;" d language:C file: macrodef:'b'
HEX input.c /^#define HEX /;" d language:C file: macrodef:0xff01
OCT input.c /^#define OCT /;" d language:C file: macrodef:0644
SYSCALL_METADATA input.c /^#define SYSCALL_METADATA(/;" d language:C file: signature:(sname,nb,...) macrodef:
Expand Down
2 changes: 1 addition & 1 deletion Units/parser-cpreprocessor.r/macrodef.d/expected.tags
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
INT input.h /^#define INT /;" d language:CPreProcessor macrodef:1
STR input.h /^#define STR /;" d language:CPreProcessor macrodef:"bar"
CHR input.h /^#define CHR /;" d language:CPreProcessor macrodef:''
CHR input.h /^#define CHR /;" d language:CPreProcessor macrodef:'b'
HEX input.h /^#define HEX /;" d language:CPreProcessor macrodef:0xff01
OCT input.h /^#define OCT /;" d language:CPreProcessor macrodef:0644
SYSCALL_METADATA input.h /^#define SYSCALL_METADATA(/;" d language:CPreProcessor signature:(sname,nb,...) macrodef:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--sort=no
--fields-C={macrodef}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
X input.c /^#define X /;" d file: macrodef:"abc \\n\\t\tefg"
Y input.c /^#define Y /;" d file: macrodef:"abc"
A input.c /^#define A /;" d file: macrodef:'a'
B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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalasS"
J input-1.c /^#define J /;" d file: macrodef:'aaaaaalast'
K input-1.c /^#define K /;" d file: macrodef:'aaaaaalast'
L input-1.c /^#define L /;" d file: macrodef:'aaaaaalast'
M input-1.c /^#define M /;" d file: macrodef:'aaaaaala\\n'
N input-1.c /^#define N /;" d file: macrodef:'aaaaaalast'
O input-1.c /^#define O /;" d file: macrodef:'aaaaaalaxx'
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#define D "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalas\
SHOULDBEINCLUDE"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#define J 'aaaaaalastSHOULDNOTBETAGGED'
#define K 'aaaaaalast\n'
#define L 'aaaaaalas\nt'
#define M 'aaaaaala\nxx'
#define N 'aaaaaalas\
t'
#define O 'aaaaaala\
xx'
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#define X "abc \n\t\
efg"
#define Y "abc"

#define A '\
a'

#define B 'b'
#define C '\n'
6 changes: 5 additions & 1 deletion main/vstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,15 @@ CTAGS_INLINE void vStringPut (vString *const string, const int c)
string->buffer [++string->length] = '\0';
}

CTAGS_INLINE void vStringPutWithLimit (vString *const string, const int c,
CTAGS_INLINE bool vStringPutWithLimit (vString *const string, const int c,
unsigned int maxlen)
{
if (vStringLength (string) < maxlen || maxlen == 0)
{
vStringPut (string, c);
return true;
}
return false;
}

#endif /* CTAGS_MAIN_VSTRING_H */
41 changes: 31 additions & 10 deletions parsers/cpreprocessor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1332,10 +1332,19 @@ static int skipToEndOfString (bool ignoreBackslash)
{
if (c == BACKSLASH && ! ignoreBackslash)
{
vStringPutWithLimit (Cpp.charOrStringContents, c, 1024);
c = cppGetcFromUngetBufferOrFile (); /* throw away next character, too */
if (c != EOF)
vStringPutWithLimit (Cpp.charOrStringContents, c, 1024);
int c0 = cppGetcFromUngetBufferOrFile ();
if (c0 == '\n')
continue;
if (c0 == EOF)
break;

if (vStringPutWithLimit (Cpp.charOrStringContents, c, 1024))
{
if (vStringPutWithLimit (Cpp.charOrStringContents, c0, 1024))
continue;
/* delete the last back slash at the end of the vstring. */
vStringChop(Cpp.charOrStringContents);
}
}
else if (c == DOUBLE_QUOTE)
break;
Expand Down Expand Up @@ -1410,10 +1419,19 @@ static int skipToEndOfChar ()
++count;
if (c == BACKSLASH)
{
vStringPutWithLimit (Cpp.charOrStringContents, c, 10);
c = cppGetcFromUngetBufferOrFile (); /* throw away next character, too */
if (c != EOF)
vStringPutWithLimit (Cpp.charOrStringContents, c, 10);
int c0 = cppGetcFromUngetBufferOrFile ();
if (c0 == '\n')
continue;
if (c0 == EOF)
break;

if (vStringPutWithLimit (Cpp.charOrStringContents, c, 10))
{
if (vStringPutWithLimit (Cpp.charOrStringContents, c0, 10))
continue;
/* delete the last back slash at the end of the vstring.*/
vStringChop(Cpp.charOrStringContents);
}
}
else if (c == SINGLE_QUOTE)
break;
Expand Down Expand Up @@ -1601,8 +1619,11 @@ extern int cppGetc (void)
/* We assume none may want to know the content of the
* literal; just put ''. */
if (macrodef)
vStringCatS (macrodef, "''");

{
vStringPut (macrodef, '\'');
vStringCat (macrodef, Cpp.charOrStringContents);
vStringPut (macrodef, '\'');
}
break;

case '/':
Expand Down

0 comments on commit a421b6c

Please sign in to comment.