History

-fdollar-in-identifiers switch which enables '$' in identifiers

library Cello: http://libcello.org/ which uses `$` and several variations of as macros. There is also RayLanguage which also uses it as a macro for a kind of ObjC style message passing: https://github.com/kojiba/RayLanguage This is a patch from Daniel Holden.

seyko committed 11 years ago

Commit dcb36581 parent e8ad3364 files · +13 −4Browse files

Unified · Split

4 files
  1. libtcc.c +1 −0
  2. tcc-doc.texi +3 −0
  3. tcc.h +1 −0
  4. tccpp.c +8 −4
libtcc.c+1−0
@@ -1482,6 +1482,7 @@ static const FlagDef flag_defs[] = { · 1481 unmodified lines
1482 { offsetof(TCCState, leading_underscore), 0, "leading-underscore" },1482 { offsetof(TCCState, leading_underscore), 0, "leading-underscore" },
1483 { offsetof(TCCState, ms_extensions), 0, "ms-extensions" },1483 { offsetof(TCCState, ms_extensions), 0, "ms-extensions" },
1484 { offsetof(TCCState, old_struct_init_code), 0, "old-struct-init-code" },1484 { offsetof(TCCState, old_struct_init_code), 0, "old-struct-init-code" },
1485 { offsetof(TCCState, dollars_in_identifiers), 0, "dollars-in-identifiers" },
1485};1486};
1486 1487
1487/* set/reset a flag */1488/* set/reset a flag */
tcc-doc.texi+3−0
@@ -241,6 +241,9 @@ Allow a MS C compiler extensions to the language. Curretly this · 240 unmodified lines
241assume a nested named structure declaration without identifier behave241assume a nested named structure declaration without identifier behave
242like an unnamed one.242like an unnamed one.
243 243
244@item -fdollars-in-identifiers
245Allow a dollars in identifiers
246
244@end table247@end table
245 248
246Warning options:249Warning options:
tcc.h+1−0
@@ -605,6 +605,7 @@ struct TCCState { · 604 unmodified lines
605 int ms_extensions; /* allow nested named struct w/o identifier behave like unnamed */605 int ms_extensions; /* allow nested named struct w/o identifier behave like unnamed */
606 int old_struct_init_code; /* use old algorithm to init array in struct when there is no '{' used.606 int old_struct_init_code; /* use old algorithm to init array in struct when there is no '{' used.
607 Liuux 2.4.26 can't find initrd when compiled with a new algorithm */607 Liuux 2.4.26 can't find initrd when compiled with a new algorithm */
608 int dollars_in_identifiers; /* allows '$' char in indentifiers */
608 609
609 /* warning switches */610 /* warning switches */
610 int warn_write_strings;611 int warn_write_strings;
tccpp.c+8−4
@@ -2286,7 +2286,10 @@ maybe_newline: · 2285 unmodified lines
2286 }2286 }
2287 }2287 }
2288 break;2288 break;
2289 2289
2290 /* treat $ as allowed char in indentifier */
2291 case '$': if (!tcc_state->dollars_in_identifiers) goto parse_simple;
2292
2290 case 'a': case 'b': case 'c': case 'd':2293 case 'a': case 'b': case 'c': case 'd':
2291 case 'e': case 'f': case 'g': case 'h':2294 case 'e': case 'f': case 'g': case 'h':
2292 case 'i': case 'j': case 'k': case 'l':2295 case 'i': case 'j': case 'k': case 'l':
@@ -2589,8 +2592,8 @@ maybe_newline: · 296 unmodified lines
2589 case ':':2592 case ':':
2590 case '?':2593 case '?':
2591 case '~':2594 case '~':
2592 case '$': /* only used in assembler */2595 case '@': /* only used in assembler */
2593 case '@': /* dito */2596 parse_simple:
2594 tok = c;2597 tok = c;
2595 p++;2598 p++;
2596 break;2599 break;
@@ -3174,7 +3177,8 @@ ST_FUNC void preprocess_new(void) · 577 unmodified lines
3174 3177
3175 /* init isid table */3178 /* init isid table */
3176 for(i=CH_EOF;i<256;i++)3179 for(i=CH_EOF;i<256;i++)
3177 isidnum_table[i-CH_EOF] = isid(i) || isnum(i);3180 isidnum_table[i-CH_EOF] = (isid(i) || isnum(i) ||
3181 (tcc_state->dollars_in_identifiers ? i == '$' : 0));
3178 3182
3179 /* add all tokens */3183 /* add all tokens */
3180 if (table_ident) {3184 if (table_ident) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t