History

Fixes include the double quotes bug Added push_macro, pop_macro support Fix pack bug, when output with-E will pack the bug

jiang committed 12 years ago

Commit 6c820761 parent 5b52a446 files · +248 −111Browse files

Unified · Split

6 files
  1. libtcc.c +5 −1
  2. tcc.h +10 −2
  3. tccgen.c +3 −3
  4. tccpp.c +203 −99
  5. tcctok.h +2 −0
  6. tests/tcctest.c +25 −6
libtcc.c+5−1
@@ -868,6 +868,7 @@ LIBTCCAPI void tcc_undefine_symbol(TCCState *s1, const char *sym) · 867 unmodified lines
868868 static void tcc_cleanup(void)
869869 {
870870 int i, n;
871+ CSym *def;
871872 if (NULL == tcc_state)
872873 return;
873874 tcc_state = NULL;
@@ -877,8 +878,11 @@ static void tcc_cleanup(void) · 3 unmodified lines
877878
878879 /* free tokens */
879880 n = tok_ident - TOK_IDENT;
880− for(i = 0; i < n; i++)
881+ for(i = 0; i < n; i++){
882+ def = &table_ident[i]->sym_define;
883+ tcc_free(def->data);
881884 tcc_free(table_ident[i]);
885+ }
882886 tcc_free(table_ident);
883887
884888 /* free sym_pools */
tcc.h+10−2
@@ -305,15 +305,22 @@ · 304 unmodified lines
305305 #define VSTACK_SIZE 256
306306 #define STRING_MAX_SIZE 1024
307307 #define PACK_STACK_SIZE 8
308+#define MACRO_STACK_SIZE 4
308309
309310 #define TOK_HASH_SIZE 8192 /* must be a power of two */
310311 #define TOK_ALLOC_INCR 512 /* must be a power of two */
311312 #define TOK_MAX_SIZE 4 /* token max size in int unit when stored in string */
312313
314+typedef struct CSym {
315+ int off;
316+ int size;/* size in *sym */
317+ struct Sym **data; /* if non NULL, data has been malloced */
318+} CSym;
319+
313320 /* token symbol management */
314321 typedef struct TokenSym {
315322 struct TokenSym *hash_next;
316− struct Sym *sym_define; /* direct pointer to define */
323+ struct CSym sym_define; /* direct pointer to define */
317324 struct Sym *sym_label; /* direct pointer to label */
318325 struct Sym *sym_struct; /* direct pointer to structure */
319326 struct Sym *sym_identifier; /* direct pointer to identifier */
@@ -1129,7 +1136,8 @@ ST_DATA TokenSym **table_ident; · 809 unmodified lines
11291136 token. line feed is also
11301137 returned at eof */
11311138 #define PARSE_FLAG_ASM_COMMENTS 0x0008 /* '#' can be used for line comment */
1132−#define PARSE_FLAG_SPACES 0x0010 /* next() returns space tokens (for -E) */
1139+#define PARSE_FLAG_SPACES 0x0010 /* next() returns space tokens (for -E) */
1140+#define PARSE_FLAG_PACK 0x0020 /* #pragma pack */
11331141
11341142 ST_FUNC TokenSym *tok_alloc(const char *str, int len);
11351143 ST_FUNC char *get_tok_str(int v, CValue *cv);
tccgen.c+3−3
@@ -5244,13 +5244,13 @@ static void init_putz(CType *t, Section *sec, unsigned long c, int size) · 5243 unmodified lines
52445244 #ifndef TCC_TARGET_X86_64
52455245 vpush_global_sym(&func_old_type, TOK_memset);
52465246 vseti(VT_LOCAL, c);
5247−#ifdef TCC_TARGET_ARM
5247+# ifdef TCC_TARGET_ARM
52485248 vpushs(size);
52495249 vpushi(0);
5250−#else
5250+# else
52515251 vpushi(0);
52525252 vpushs(size);
5253−#endif
5253+# endif
52545254 gfunc_call(3);
52555255 #else
52565256 vseti(VT_LOCAL, c);
tccpp.c+203−99
@@ -233,7 +233,10 @@ static TokenSym *tok_alloc_new(TokenSym **pts, const char *str, int len) · 232 unmodified lines
233233 ts = tcc_malloc(sizeof(TokenSym) + len);
234234 table_ident[i] = ts;
235235 ts->tok = tok_ident++;
236− ts->sym_define = NULL;
236+ ts->sym_define.data = tcc_malloc(sizeof(Sym**));
237+ ts->sym_define.off = 0;
238+ ts->sym_define.data[0] = NULL;
239+ ts->sym_define.size = 1;
237240 ts->sym_label = NULL;
238241 ts->sym_struct = NULL;
239242 ts->sym_identifier = NULL;
@@ -1052,52 +1055,62 @@ static int macro_is_equal(const int *a, const int *b) · 812 unmodified lines
10521055 ST_INLN void define_push(int v, int macro_type, int *str, Sym *first_arg)
10531056 {
10541057 Sym *s;
1055−
1058+ CSym *def;
10561059 s = define_find(v);
10571060 if (s && !macro_is_equal(s->d, str))
10581061 tcc_warning("%s redefined", get_tok_str(v, NULL));
1059−
10601062 s = sym_push2(&define_stack, v, macro_type, 0);
10611063 s->d = str;
10621064 s->next = first_arg;
1063− table_ident[v - TOK_IDENT]->sym_define = s;
1065+ def = &table_ident[v - TOK_IDENT]->sym_define;
1066+ def->data[def->off] = s;
10641067 }
10651068
10661069 /* undefined a define symbol. Its name is just set to zero */
10671070 ST_FUNC void define_undef(Sym *s)
10681071 {
10691072 int v;
1070− v = s->v;
1071− if (v >= TOK_IDENT && v < tok_ident)
1072− table_ident[v - TOK_IDENT]->sym_define = NULL;
1073− s->v = 0;
1073+ CSym *def;
1074+ v = s->v - TOK_IDENT;
1075+ if ((unsigned)v < (unsigned)(tok_ident - TOK_IDENT)){
1076+ def = &table_ident[v]->sym_define;
1077+ def->data[def->off] = NULL;
1078+ }
10741079 }
10751080
10761081 ST_INLN Sym *define_find(int v)
10771082 {
1083+ CSym *def;
10781084 v -= TOK_IDENT;
10791085 if ((unsigned)v >= (unsigned)(tok_ident - TOK_IDENT))
10801086 return NULL;
1081− return table_ident[v]->sym_define;
1087+ def = &table_ident[v]->sym_define;
1088+ return def->data[def->off];
10821089 }
10831090
10841091 /* free define stack until top reaches 'b' */
10851092 ST_FUNC void free_defines(Sym *b)
10861093 {
1087− Sym *top, *top1;
1094+ Sym *top, *tmp;
10881095 int v;
1096+ CSym *def;
10891097
10901098 top = define_stack;
10911099 while (top != b) {
1092− top1 = top->prev;
1100+ tmp = top->prev;
10931101 /* do not free args or predefined defines */
10941102 if (top->d)
10951103 tok_str_free(top->d);
1096− v = top->v;
1097− if (v >= TOK_IDENT && v < tok_ident)
1098− table_ident[v - TOK_IDENT]->sym_define = NULL;
1104+ v = top->v - TOK_IDENT;
1105+ if ((unsigned)v < (unsigned)(tok_ident - TOK_IDENT)){
1106+ def = &table_ident[v]->sym_define;
1107+ if(def->off)
1108+ def->off = 0;
1109+ if(def->data[0])
1110+ def->data[0] = NULL;
1111+ }
10991112 sym_free(top);
1100− top = top1;
1113+ top = tmp;
11011114 }
11021115 define_stack = b;
11031116 }
@@ -1338,66 +1351,18 @@ static inline void add_cached_include(TCCState *s1, const char *filename, int if · 234 unmodified lines
13381351 s1->cached_includes_hash[h] = s1->nb_cached_includes;
13391352 }
13401353
1341−static void pragma_parse(TCCState *s1)
1342−{
1343− int val;
1344−
1345− next();
1346− if (tok == TOK_pack) {
1347− /*
1348− This may be:
1349− #pragma pack(1) // set
1350− #pragma pack() // reset to default
1351− #pragma pack(push,1) // push & set
1352− #pragma pack(pop) // restore previous
1353− */
1354− next();
1355− skip('(');
1356− if (tok == TOK_ASM_pop) {
1357− next();
1358− if (s1->pack_stack_ptr <= s1->pack_stack) {
1359− stk_error:
1360− tcc_error("out of pack stack");
1361− }
1362− s1->pack_stack_ptr--;
1363− } else {
1364− val = 0;
1365− if (tok != ')') {
1366− if (tok == TOK_ASM_push) {
1367− next();
1368− if (s1->pack_stack_ptr >= s1->pack_stack + PACK_STACK_SIZE - 1)
1369− goto stk_error;
1370− s1->pack_stack_ptr++;
1371− skip(',');
1372− }
1373− if (tok != TOK_CINT) {
1374− pack_error:
1375− tcc_error("invalid pack pragma");
1376− }
1377− val = tokc.i;
1378− if (val < 1 || val > 16 || (val & (val - 1)) != 0)
1379− goto pack_error;
1380− next();
1381− }
1382− *s1->pack_stack_ptr = val;
1383− skip(')');
1384− }
1385− }
1386−}
1387−
13881354 /* is_bof is true if first non space token at beginning of file */
13891355 ST_FUNC void preprocess(int is_bof)
13901356 {
13911357 TCCState *s1 = tcc_state;
13921358 int i, c, n, saved_parse_flags;
1393− char buf[1024], *q;
1359+ uint8_t buf[1024], *p;
13941360 Sym *s;
13951361
13961362 saved_parse_flags = parse_flags;
1397− parse_flags = PARSE_FLAG_PREPROCESS | PARSE_FLAG_TOK_NUM |
1398− PARSE_FLAG_LINEFEED;
1363+ parse_flags = PARSE_FLAG_PREPROCESS | PARSE_FLAG_TOK_NUM | PARSE_FLAG_LINEFEED;
13991364 next_nomacro();
1400− redo:
1365+redo:
14011366 switch(tok) {
14021367 case TOK_DEFINE:
14031368 next_nomacro();
@@ -1420,19 +1385,21 @@ ST_FUNC void preprocess(int is_bof) · 16 unmodified lines
14201385 goto read_name;
14211386 } else if (ch == '\"') {
14221387 c = ch;
1423− read_name:
1388+read_name:
14241389 inp();
1425− q = buf;
1390+ p = buf;
14261391 while (ch != c && ch != '\n' && ch != CH_EOF) {
1427− if ((q - buf) < sizeof(buf) - 1)
1428− *q++ = ch;
1392+ if ((p - buf) < sizeof(buf) - 1)
1393+ *p++ = ch;
14291394 if (ch == '\\') {
14301395 if (handle_stray_noerror() == 0)
1431− --q;
1396+ --p;
14321397 } else
14331398 inp();
14341399 }
1435− *q = '\0';
1400+ if (ch != c)
1401+ goto include_syntax;
1402+ *p = '\0';
14361403 minp();
14371404 #if 0
14381405 /* eat all spaces and comments after include */
@@ -1470,6 +1437,8 @@ ST_FUNC void preprocess(int is_bof) · 31 unmodified lines
14701437 c = '>';
14711438 }
14721439 }
1440+ if(!buf[0])
1441+ tcc_error(" empty filename in #include");
14731442
14741443 if (s1->include_stack_ptr >= s1->include_stack + INCLUDE_STACK_SIZE)
14751444 tcc_error("#include recursion too deep");
@@ -1536,8 +1505,7 @@ include_trynext: · 60 unmodified lines
15361505 printf("%s: including %s\n", file->prev->filename, file->filename);
15371506 #endif
15381507 /* update target deps */
1539− dynarray_add((void ***)&s1->target_deps, &s1->nb_target_deps,
1540− tcc_strdup(buf1));
1508+ dynarray_add((void ***)&s1->target_deps, &s1->nb_target_deps, tcc_strdup(buf1));
15411509 /* push current file in stack */
15421510 ++s1->include_stack_ptr;
15431511 /* add include file debug info */
@@ -1570,7 +1538,7 @@ include_done: · 26 unmodified lines
15701538 file->ifndef_macro = tok;
15711539 }
15721540 }
1573− c = (define_find(tok) != 0) ^ c;
1541+ c = !!define_find(tok) ^ c;
15741542 do_if:
15751543 if (s1->ifdef_stack_ptr >= s1->ifdef_stack + IFDEF_STACK_SIZE)
15761544 tcc_error("memory full (ifdef)");
@@ -1594,12 +1562,12 @@ include_done: · 17 unmodified lines
15941562 goto skip;
15951563 c = expr_preprocess();
15961564 s1->ifdef_stack_ptr[-1] = c;
1597− test_else:
1565+test_else:
15981566 if (s1->ifdef_stack_ptr == file->ifdef_stack_ptr + 1)
15991567 file->ifndef_macro = 0;
1600− test_skip:
1568+test_skip:
16011569 if (!(c & 1)) {
1602− skip:
1570+skip:
16031571 preprocess_skip();
16041572 is_bof = 0;
16051573 goto redo;
@@ -1617,11 +1585,11 @@ include_done: · 11 unmodified lines
16171585 /* need to set to zero to avoid false matches if another
16181586 #ifndef at middle of file */
16191587 file->ifndef_macro = 0;
1620− while (tok != TOK_LINEFEED)
1621− next_nomacro();
16221588 tok_flags |= TOK_FLAG_ENDIF;
1623− goto the_end;
16241589 }
1590+ next_nomacro();
1591+ if (tok != TOK_LINEFEED)
1592+ tcc_warning("Ignoring: %s", get_tok_str(tok, &tokc));
16251593 break;
16261594 case TOK_LINE:
16271595 next();
@@ -1632,8 +1600,7 @@ include_done: · 4 unmodified lines
16321600 if (tok != TOK_LINEFEED) {
16331601 if (tok != TOK_STR)
16341602 tcc_error("#line");
1635− pstrcpy(file->filename, sizeof(file->filename),
1636− (char *)tokc.cstr->data);
1603+ pstrcpy(file->filename, sizeof(file->filename), (char *)tokc.cstr->data);
16371604 }
16381605 break;
16391606 case TOK_ERROR:
@@ -1641,24 +1608,161 @@ include_done: · 1 unmodified line
16411608 c = tok;
16421609 ch = file->buf_ptr[0];
16431610 skip_spaces();
1644− q = buf;
1611+ p = buf;
16451612 while (ch != '\n' && ch != CH_EOF) {
1646− if ((q - buf) < sizeof(buf) - 1)
1647− *q++ = ch;
1613+ if ((p - buf) < sizeof(buf) - 1)
1614+ *p++ = ch;
16481615 if (ch == '\\') {
16491616 if (handle_stray_noerror() == 0)
1650− --q;
1617+ --p;
16511618 } else
16521619 inp();
16531620 }
1654− *q = '\0';
1621+ *p = '\0';
16551622 if (c == TOK_ERROR)
16561623 tcc_error("#error %s", buf);
16571624 else
16581625 tcc_warning("#warning %s", buf);
16591626 break;
16601627 case TOK_PRAGMA:
1661− pragma_parse(s1);
1628+ next();
1629+ if (tok == TOK_pack && parse_flags & PARSE_FLAG_PACK) {
1630+ /*
1631+ This may be:
1632+ #pragma pack(1) // set
1633+ #pragma pack() // reset to default
1634+ #pragma pack(push,1) // push & set
1635+ #pragma pack(pop) // restore previous
1636+ */
1637+ next();
1638+ skip('(');
1639+ if (tok == TOK_ASM_pop) {
1640+ next();
1641+ if (s1->pack_stack_ptr <= s1->pack_stack) {
1642+stk_error:
1643+ tcc_error("out of pack stack");
1644+ }
1645+ s1->pack_stack_ptr--;
1646+ } else {
1647+ int val = 0;
1648+ if (tok != ')') {
1649+ if (tok == TOK_ASM_push) {
1650+ next();
1651+ s1->pack_stack_ptr++;
1652+ if (s1->pack_stack_ptr >= s1->pack_stack + PACK_STACK_SIZE)
1653+ goto stk_error;
1654+ skip(',');
1655+ }
1656+ if (tok != TOK_CINT) {
1657+pack_error:
1658+ tcc_error("invalid pack pragma");
1659+ }
1660+ val = tokc.i;
1661+ if (val < 1 || val > 16)
1662+ goto pack_error;
1663+ if (val < 1 || val > 16)
1664+ tcc_error("Value must be greater than 1 is less than or equal to 16");
1665+ if ((val & (val - 1)) != 0)
1666+ tcc_error("Value must be a power of 2 curtain");
1667+ next();
1668+ }
1669+ *s1->pack_stack_ptr = val;
1670+ skip(')');
1671+ }
1672+ }else if (tok == TOK_PUSH_MACRO || tok == TOK_POP_MACRO) {
1673+ TokenSym *ts;
1674+ CSym *def;
1675+ uint8_t *p1;
1676+ int len, t;
1677+ t = tok;
1678+ ch = file->buf_ptr[0];
1679+ skip_spaces();
1680+ if (ch != '(')
1681+ goto macro_xxx_syntax;
1682+ /* XXX: incorrect if comments : use next_nomacro with a special mode */
1683+ inp();
1684+ skip_spaces();
1685+ if (ch == '\"'){
1686+ inp();
1687+ p = buf;
1688+ while (ch != '\"' && ch != '\n' && ch != CH_EOF) {
1689+ if ((p - buf) < sizeof(buf) - 1)
1690+ *p++ = ch;
1691+ if (ch == CH_EOB) {
1692+ --p;
1693+ handle_stray();
1694+ }else
1695+ inp();
1696+ }
1697+ if(ch != '\"')
1698+ goto macro_xxx_syntax;
1699+ *p = '\0';
1700+ minp();
1701+ next();
1702+ }else{
1703+ /* computed #pragma macro_xxx for #define xxx */
1704+ next();
1705+ buf[0] = '\0';
1706+ while (tok != ')') {
1707+ if (tok != TOK_STR) {
1708+ macro_xxx_syntax:
1709+ tcc_error("'macro_xxx' expects (\"NAME\")");
1710+ }
1711+ pstrcat(buf, sizeof(buf), (char *)tokc.cstr->data);
1712+ next();
1713+ }
1714+ }
1715+ skip (')');
1716+ if(!buf[0])
1717+ tcc_error(" empty string in #pragma");
1718+ /* find TokenSym */
1719+ p = buf;
1720+ while (is_space(*p))
1721+ p++;
1722+ p1 = p;
1723+ for(;;){
1724+ if (!isidnum_table[p[0] - CH_EOF])
1725+ break;
1726+ ++p;
1727+ }
1728+ len = p - p1;
1729+ while (is_space(*p))
1730+ p++;
1731+ if(!p) //'\0'
1732+ tcc_error("unrecognized string: %s", buf);
1733+ ts = tok_alloc(p1, len);
1734+ if(ts){
1735+ def = &ts->sym_define;
1736+ if(t == TOK_PUSH_MACRO){
1737+ void *tmp = def->data[def->off];
1738+ if(tmp){
1739+ def->off++;
1740+ if(def->off >= def->size){
1741+ int size = def->size;
1742+ size *= 2;
1743+ if (size >= MACRO_STACK_SIZE)
1744+ tcc_error("stack full");
1745+ def->data = tcc_realloc(def->data, size*sizeof(Sym**));
1746+ def->size = size;
1747+ }
1748+ def->data[def->off] = tmp;
1749+ }
1750+ }else{
1751+ if(def->off){
1752+ --def->off;
1753+ }else{
1754+ tcc_warning("stack empty");
1755+ }
1756+ }
1757+ }
1758+ }else{
1759+ fputs("#pragma ", s1->ppfp);
1760+ while (tok != TOK_LINEFEED){
1761+ fputs(get_tok_str(tok, &tokc), s1->ppfp);
1762+ next();
1763+ }
1764+ goto the_end;
1765+ }
16621766 break;
16631767 default:
16641768 if (tok == TOK_LINEFEED || tok == '!' || tok == TOK_PPNUM) {
@@ -1678,7 +1782,7 @@ include_done: · 13 unmodified lines
16781782 /* ignore other preprocess commands or #! for C scripts */
16791783 while (tok != TOK_LINEFEED)
16801784 next_nomacro();
1681− the_end:
1785+the_end:
16821786 parse_flags = saved_parse_flags;
16831787 }
16841788
@@ -3030,12 +3134,13 @@ ST_FUNC int tcc_preprocess(TCCState *s1) · 1345 unmodified lines
30303134 ch = file->buf_ptr[0];
30313135 tok_flags = TOK_FLAG_BOL | TOK_FLAG_BOF;
30323136 parse_flags = PARSE_FLAG_ASM_COMMENTS | PARSE_FLAG_PREPROCESS |
3033− PARSE_FLAG_LINEFEED | PARSE_FLAG_SPACES;
3137+ PARSE_FLAG_LINEFEED | PARSE_FLAG_SPACES;
30343138 token_seen = 0;
30353139 line_ref = 0;
30363140 file_ref = NULL;
30373141 iptr = s1->include_stack_ptr;
3038−
3142+ tok = TOK_LINEFEED; /* print line */
3143+ goto print_line;
30393144 for (;;) {
30403145 next();
30413146 if (tok == TOK_EOF) {
@@ -3043,11 +3148,11 @@ ST_FUNC int tcc_preprocess(TCCState *s1) · 1 unmodified line
30433148 } else if (file != file_ref) {
30443149 goto print_line;
30453150 } else if (tok == TOK_LINEFEED) {
3046− if (!token_seen)
3151+ if (token_seen)
30473152 continue;
30483153 ++line_ref;
3049− token_seen = 0;
3050− } else if (!token_seen) {
3154+ token_seen = 1;
3155+ } else if (token_seen) {
30513156 d = file->line_num - line_ref;
30523157 if (file != file_ref || d < 0 || d >= 8) {
30533158 print_line:
@@ -3055,8 +3160,7 @@ print_line: · 1 unmodified line
30553160 s = iptr_new > iptr ? " 1"
30563161 : iptr_new < iptr ? " 2"
30573162 : iptr_new > s1->include_stack ? " 3"
3058− : ""
3059− ;
3163+ : "";
30603164 iptr = iptr_new;
30613165 fprintf(s1->ppfp, "# %d \"%s\"%s\n", file->line_num, file->filename, s);
30623166 } else {
@@ -3064,8 +3168,8 @@ print_line: · 1 unmodified line
30643168 fputs("\n", s1->ppfp), --d;
30653169 }
30663170 line_ref = (file_ref = file)->line_num;
3067− token_seen = tok != TOK_LINEFEED;
3068− if (!token_seen)
3171+ token_seen = tok == TOK_LINEFEED;
3172+ if (token_seen)
30693173 continue;
30703174 }
30713175 fputs(get_tok_str(tok, &tokc), s1->ppfp);
tcctok.h+2−0
@@ -138,6 +138,8 @@ · 137 unmodified lines
138138
139139 /* pragma */
140140 DEF(TOK_pack, "pack")
141+ DEF(TOK_PUSH_MACRO, "push_macro")
142+ DEF(TOK_POP_MACRO, "pop_macro")
141143 #if !defined(TCC_TARGET_I386) && !defined(TCC_TARGET_X86_64)
142144 /* already defined for assembler */
143145 DEF(TOK_ASM_push, "push")
tests/tcctest.c+25−6
@@ -235,7 +235,7 @@ void intdiv_test(void) · 234 unmodified lines
235235
236236 void macro_test(void)
237237 {
238− printf("macro:\n");
238+ printf("macro:\n");
239239 pf("N=%d\n", N);
240240 printf("aaa=%d\n", AAA);
241241
@@ -379,6 +379,23 @@ comment · 137 unmodified lines
379379 /* And again when the name and parenthes are separated by a
380380 comment. */
381381 TEST2 /* the comment */ ();
382+ /* macro_push and macro_pop test */
383+ #define MACRO_TEST "macro_test1\n"
384+ #pragma push_macro("MACRO_TEST")
385+ #undef MACRO_TEST
386+ #define MACRO_TEST "macro_test2\n"
387+ printf(MACRO_TEST);
388+ #pragma pop_macro("MACRO_TEST")
389+ printf(MACRO_TEST);
390+/* gcc does not support
391+ #define MACRO_TEST_MACRO "MACRO_TEST"
392+ #pragma push_macro(MACRO_TEST_MACRO)
393+ #undef MACRO_TEST
394+ #define MACRO_TEST "macro_test3\n"
395+ printf(MACRO_TEST);
396+ #pragma pop_macro(MACRO_TEST_MACRO)
397+ printf(MACRO_TEST);
398+*/
382399 }
383400
384401
@@ -2167,14 +2184,15 @@ void whitespace_test(void) · 1782 unmodified lines
21672184 {
21682185 char *str;
21692186
2170− #if 1
2187+
2188+#if 1
21712189 pri\
2172−ntf("whitspace:\n");
2190+ntf("whitspace:\n");
21732191 #endif
21742192 pf("N=%d\n", 2);
21752193
21762194 #ifdef CORRECT_CR_HANDLING
2177− pri\
2195+ pri\
21782196 ntf("aaa=%d\n", 3);
21792197 #endif
21802198
@@ -2186,11 +2204,12 @@ ntf("min=%d\n", 4); · 5 unmodified lines
21862204 printf("len1=%d\n", strlen("
21872205 "));
21882206 #ifdef CORRECT_CR_HANDLING
2189− str = "
2207+ str = "
21902208 ";
21912209 printf("len1=%d str[0]=%d\n", strlen(str), str[0]);
21922210 #endif
2193− printf("len1=%d\n", strlen(" a
2211+ printf("len1=%d\n", strlen("
2212+a
21942213 "));
21952214 #endif /* ACCEPT_CR_IN_STRINGS */
21962215 }

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