diff options
author | Andreas Scherer <andreas_tex@freenet.de> | 2022-03-10 10:50:21 +0000 |
---|---|---|
committer | Andreas Scherer <andreas_tex@freenet.de> | 2022-03-10 10:50:21 +0000 |
commit | d175af836458d771660138715f0a2bde9f3e4ced (patch) | |
tree | e4c65269e90847c4cc9a781556ef8a999ea90928 | |
parent | 84d765e78c8984e8911848e0ce62ec17dfef541e (diff) |
[CWEB] Make 'fall thru' comments active.
This is specific for GCC, but totally harmless for any other C compiler:
GCC accepts 'fall thru' comments from the CWEB sources with its option
'-Wimplicit-fallthrough=2', when we push these comments over to the
tangled C code.
git-svn-id: svn://tug.org/texlive/trunk@62584 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/web2c/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/ctangleboot.cin | 80 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ChangeLog | 11 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/Makefile | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctang-w2c.ch | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctangle.c | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctangle.w | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctwill-mini.ch | 16 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctwill-w2c.ch | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/cweav-w2c.ch | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/cweave.w | 15 |
11 files changed, 83 insertions, 59 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index 15ce99f9290..a5821c23dec 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -1,3 +1,7 @@ +2022-03-10 Andreas Scherer <https://ascherer.github.io> + + * ctangleboot.cin: Make 'fall thru' comments active. + 2022-03-03 Andreas Scherer <https://ascherer.github.io> * cpascal.h, diff --git a/Build/source/texk/web2c/ctangleboot.cin b/Build/source/texk/web2c/ctangleboot.cin index 5d0b10ec927..18ba68505ce 100644 --- a/Build/source/texk/web2c/ctangleboot.cin +++ b/Build/source/texk/web2c/ctangleboot.cin @@ -274,7 +274,7 @@ extern FILE*active_file; extern FILE*check_file; /*:15*//*116:*/ -#line 504 "cwebdir/ctang-w2c.ch" +#line 506 "cwebdir/ctang-w2c.ch" extern char cb_banner[]; @@ -540,7 +540,7 @@ ccode['\'']= ord; section_text[0]= ' '; /*:78*//*117:*/ -#line 507 "cwebdir/ctang-w2c.ch" +#line 509 "cwebdir/ctang-w2c.ch" strncpy(cb_banner,banner,max_banner-1); @@ -754,11 +754,11 @@ writeloop:/*50:*/ if(check_for_change){ fclose(C_file);C_file= NULL; /*106:*/ -#line 387 "cwebdir/ctang-w2c.ch" +#line 389 "cwebdir/ctang-w2c.ch" if((C_file= fopen(C_file_name,"r"))!=NULL){ /*107:*/ -#line 394 "cwebdir/ctang-w2c.ch" +#line 396 "cwebdir/ctang-w2c.ch" boolean comparison= false; @@ -767,7 +767,7 @@ fatal(_("! Cannot open output file "),check_file_name); /*108:*/ -#line 408 "cwebdir/ctang-w2c.ch" +#line 410 "cwebdir/ctang-w2c.ch" do{ char x[BUFSIZ],y[BUFSIZ]; @@ -777,17 +777,17 @@ comparison= (x_size==y_size)&&!memcmp(x,y,x_size); }while(comparison&&!feof(C_file)&&!feof(check_file)); /*:108*/ -#line 401 "cwebdir/ctang-w2c.ch" +#line 403 "cwebdir/ctang-w2c.ch" fclose(C_file);C_file= NULL; fclose(check_file);check_file= NULL; /*:107*/ -#line 389 "cwebdir/ctang-w2c.ch" +#line 391 "cwebdir/ctang-w2c.ch" /*109:*/ -#line 419 "cwebdir/ctang-w2c.ch" +#line 421 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -797,7 +797,7 @@ rename(check_file_name,C_file_name); } /*:109*/ -#line 390 "cwebdir/ctang-w2c.ch" +#line 392 "cwebdir/ctang-w2c.ch" }else rename(check_file_name,C_file_name); @@ -810,7 +810,7 @@ for(an_output_file= end_output_files;an_output_file> cur_out_file;){ an_output_file--; sprint_section_name(output_file_name,*an_output_file); if(check_for_change)/*105:*/ -#line 378 "cwebdir/ctang-w2c.ch" +#line 380 "cwebdir/ctang-w2c.ch" { if((C_file= fopen(output_file_name,"a"))==NULL) fatal(_("! Cannot open output file "),output_file_name); @@ -841,14 +841,14 @@ flush_buffer(); if(check_for_change){ fclose(C_file);C_file= NULL; /*110:*/ -#line 432 "cwebdir/ctang-w2c.ch" +#line 434 "cwebdir/ctang-w2c.ch" if(0==strcmp("/dev/stdout",output_file_name)) /*112:*/ -#line 459 "cwebdir/ctang-w2c.ch" +#line 461 "cwebdir/ctang-w2c.ch" { /*115:*/ -#line 490 "cwebdir/ctang-w2c.ch" +#line 492 "cwebdir/ctang-w2c.ch" char in_buf[BUFSIZ+1]; int in_size; @@ -858,7 +858,7 @@ fatal(_("! Cannot open output file "),check_file_name); /*:115*/ -#line 460 "cwebdir/ctang-w2c.ch" +#line 462 "cwebdir/ctang-w2c.ch" do{ in_size= fread(in_buf,sizeof(char),BUFSIZ,check_file); @@ -867,7 +867,7 @@ fprintf(stdout,"%s",in_buf); }while(!feof(check_file)); fclose(check_file);check_file= NULL; /*111:*/ -#line 449 "cwebdir/ctang-w2c.ch" +#line 451 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -877,19 +877,19 @@ rename(check_file_name,output_file_name); } /*:111*/ -#line 467 "cwebdir/ctang-w2c.ch" +#line 469 "cwebdir/ctang-w2c.ch" } /*:112*/ -#line 434 "cwebdir/ctang-w2c.ch" +#line 436 "cwebdir/ctang-w2c.ch" else if(0==strcmp("/dev/stderr",output_file_name)) /*113:*/ -#line 472 "cwebdir/ctang-w2c.ch" +#line 474 "cwebdir/ctang-w2c.ch" { /*115:*/ -#line 490 "cwebdir/ctang-w2c.ch" +#line 492 "cwebdir/ctang-w2c.ch" char in_buf[BUFSIZ+1]; int in_size; @@ -899,7 +899,7 @@ fatal(_("! Cannot open output file "),check_file_name); /*:115*/ -#line 473 "cwebdir/ctang-w2c.ch" +#line 475 "cwebdir/ctang-w2c.ch" do{ in_size= fread(in_buf,sizeof(char),BUFSIZ,check_file); @@ -908,7 +908,7 @@ fprintf(stderr,"%s",in_buf); }while(!feof(check_file)); fclose(check_file);check_file= NULL; /*111:*/ -#line 449 "cwebdir/ctang-w2c.ch" +#line 451 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -918,20 +918,20 @@ rename(check_file_name,output_file_name); } /*:111*/ -#line 480 "cwebdir/ctang-w2c.ch" +#line 482 "cwebdir/ctang-w2c.ch" } /*:113*/ -#line 436 "cwebdir/ctang-w2c.ch" +#line 438 "cwebdir/ctang-w2c.ch" else if(0==strcmp("/dev/null",output_file_name)) /*114:*/ -#line 485 "cwebdir/ctang-w2c.ch" +#line 487 "cwebdir/ctang-w2c.ch" { boolean comparison= true; /*111:*/ -#line 449 "cwebdir/ctang-w2c.ch" +#line 451 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -941,17 +941,17 @@ rename(check_file_name,output_file_name); } /*:111*/ -#line 487 "cwebdir/ctang-w2c.ch" +#line 489 "cwebdir/ctang-w2c.ch" } /*:114*/ -#line 438 "cwebdir/ctang-w2c.ch" +#line 440 "cwebdir/ctang-w2c.ch" else{ if((C_file= fopen(output_file_name,"r"))!=NULL){ /*107:*/ -#line 394 "cwebdir/ctang-w2c.ch" +#line 396 "cwebdir/ctang-w2c.ch" boolean comparison= false; @@ -960,7 +960,7 @@ fatal(_("! Cannot open output file "),check_file_name); /*108:*/ -#line 408 "cwebdir/ctang-w2c.ch" +#line 410 "cwebdir/ctang-w2c.ch" do{ char x[BUFSIZ],y[BUFSIZ]; @@ -970,17 +970,17 @@ comparison= (x_size==y_size)&&!memcmp(x,y,x_size); }while(comparison&&!feof(C_file)&&!feof(check_file)); /*:108*/ -#line 401 "cwebdir/ctang-w2c.ch" +#line 403 "cwebdir/ctang-w2c.ch" fclose(C_file);C_file= NULL; fclose(check_file);check_file= NULL; /*:107*/ -#line 441 "cwebdir/ctang-w2c.ch" +#line 443 "cwebdir/ctang-w2c.ch" /*111:*/ -#line 449 "cwebdir/ctang-w2c.ch" +#line 451 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -990,7 +990,7 @@ rename(check_file_name,output_file_name); } /*:111*/ -#line 442 "cwebdir/ctang-w2c.ch" +#line 444 "cwebdir/ctang-w2c.ch" }else rename(check_file_name,output_file_name); @@ -1153,7 +1153,7 @@ case string:if(out_state==verbatim)out_state= normal; else out_state= verbatim;break; case'/':C_putc('/');out_state= post_slash;break; case'*':if(out_state==post_slash)C_putc(' '); - +/* fall through */ default:C_putc(cur_char);out_state= normal;break; } } @@ -1930,7 +1930,7 @@ while(xisspace(*loc)&&loc<limit)loc++; loc+= 3; if(loc> limit||!xisxdigit(*(loc-3))||!xisxdigit(*(loc-2)) ||(*(loc-3)>='0'&&*(loc-3)<='7')||!xisspace(*(loc-1))) -#line 330 "cwebdir/ctang-w2c.ch" +#line 332 "cwebdir/ctang-w2c.ch" err_print(_("! Improper hex number following @l")); #line 1529 "cwebdir/ctangle.w" @@ -1942,7 +1942,7 @@ while(xisspace(*loc)&&loc<limit)loc++; beg= loc; while(loc<limit&&(xisalpha(*loc)||xisdigit(*loc)||*loc=='_'))loc++; if(loc-beg>=translit_length) -#line 336 "cwebdir/ctang-w2c.ch" +#line 338 "cwebdir/ctang-w2c.ch" err_print(_("! Replacement string in @l too long")); #line 1539 "cwebdir/ctangle.w" @@ -1964,8 +1964,8 @@ err_print(_("! Double @ should be used in control text")); #line 1511 "cwebdir/ctangle.w" break; -} -#line 324 "cwebdir/ctang-w2c.ch" +#line 325 "cwebdir/ctang-w2c.ch" +}/* otherwise fall through */ default:err_print(_("! Double @ should be used in limbo")); #line 1515 "cwebdir/ctangle.w" @@ -1979,7 +1979,7 @@ default:err_print(_("! Double @ should be used in limbo")); void print_stats(void){ -#line 349 "cwebdir/ctang-w2c.ch" +#line 351 "cwebdir/ctang-w2c.ch" puts(_("\nMemory usage statistics:")); printf(_("%td names (out of %ld)\n"), (ptrdiff_t)(name_ptr-name_dir),(long)max_names); @@ -1992,5 +1992,5 @@ printf(_("%td tokens (out of %ld)\n"), (ptrdiff_t)(tok_ptr-tok_mem),(long)max_toks); } -#line 362 "cwebdir/ctang-w2c.ch" +#line 364 "cwebdir/ctang-w2c.ch" /*:103*/ diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog index c370c7d0621..3e55aa657b8 100644 --- a/Build/source/texk/web2c/cwebdir/ChangeLog +++ b/Build/source/texk/web2c/cwebdir/ChangeLog @@ -1,3 +1,14 @@ +2022-03-10 Andreas Scherer <https://ascherer.github.io> + + * Makefile, + * ctang-w2c.ch, + * ctangle.c, + * ctangle.w, + * ctwill-mini.ch, + * ctwill-w2c.ch, + * cweav-w2c.ch, + * cweave.w: Make 'fall thru' comments active. + 2022-02-18 Andreas Scherer <https://ascherer.github.io> * common.c, diff --git a/Build/source/texk/web2c/cwebdir/Makefile b/Build/source/texk/web2c/cwebdir/Makefile index 92e59b857b8..d3bc422059b 100644 --- a/Build/source/texk/web2c/cwebdir/Makefile +++ b/Build/source/texk/web2c/cwebdir/Makefile @@ -50,7 +50,7 @@ TCHANGES= WCHANGES= # We keep debugging info around, for fun, but most users don't need it -CFLAGS = -g +CFLAGS = -g # -Wall -Wextra -Wimplicit-fallthrough=2 # check compiler warnings #CFLAGS = -O LINKFLAGS = -g #LINKFLAGS = -s # for smaller (stripped) executables on many UNIX systems diff --git a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch index 6a284181224..ed91b9d7e5d 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch @@ -319,8 +319,10 @@ case output_defs_code: if (t!=section_name) err_print(_("! Misplaced @@h")); @z @x + } @=/* otherwise fall through */@> default: err_print("! Double @@ should be used in limbo"); @y + } @=/* otherwise fall through */@> default: err_print(_("! Double @@ should be used in limbo")); @z diff --git a/Build/source/texk/web2c/cwebdir/ctangle.c b/Build/source/texk/web2c/cwebdir/ctangle.c index b6037a87dd9..bc00c0cf7f3 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.c +++ b/Build/source/texk/web2c/cwebdir/ctangle.c @@ -866,7 +866,7 @@ case string:if(out_state==verbatim)out_state= normal; else out_state= verbatim;break; case'/':C_putc('/');out_state= post_slash;break; case'*':if(out_state==post_slash)C_putc(' '); - +/* fall through */ default:C_putc(cur_char);out_state= normal;break; } } @@ -1627,7 +1627,7 @@ if(*(loc-1)!='>') err_print("! Double @ should be used in control text"); break; -} +}/* otherwise fall through */ default:err_print("! Double @ should be used in limbo"); } diff --git a/Build/source/texk/web2c/cwebdir/ctangle.w b/Build/source/texk/web2c/cwebdir/ctangle.w index c2fc88af747..a0f7cc17d4a 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.w +++ b/Build/source/texk/web2c/cwebdir/ctangle.w @@ -666,7 +666,7 @@ restart: else out_state=verbatim; break; case '/': C_putc('/'); out_state=post_slash; break; case '*': if (out_state==post_slash) C_putc(' '); - /* fall through */ + @=/* fall through */@> default: C_putc(cur_char); out_state=normal; break; } } @@ -1510,7 +1510,7 @@ skip_limbo(void) err_print("! Double @@ should be used in control text"); @.Double @@ should be used...@> break; - } /* otherwise fall through */ + } @=/* otherwise fall through */@> default: err_print("! Double @@ should be used in limbo"); @.Double @@ should be used...@> } diff --git a/Build/source/texk/web2c/cwebdir/ctwill-mini.ch b/Build/source/texk/web2c/cwebdir/ctwill-mini.ch index e7725904503..0411aad1d06 100644 --- a/Build/source/texk/web2c/cwebdir/ctwill-mini.ch +++ b/Build/source/texk/web2c/cwebdir/ctwill-mini.ch @@ -1556,7 +1556,7 @@ Section 233--234. case end_translation: return; case identifier: case res_word: @<Output an identifier@>@; break; case section_code: @<Output a section name@>@; break; - case math_rel: out_str("\\MRL{"@q}@>); /* fall through */ + case math_rel: out_str("\\MRL{"@q}@>); @=/* fall through */@> @.\\MRL@> case noop: case inserted: break; case cancel: case big_cancel: c=0; b=a; @@ -1578,11 +1578,11 @@ Section 233--234. if (a!=big_force) { out_str("\\1\\1"); goto reswitch; } - else dindent_pending=true; /* fall through */ + else dindent_pending=true; @=/* fall through */@> case indent: case outdent: case opt: case backup: case break_space: case force: case big_force: case preproc_line: @<Output a control, look ahead in case of line breaks, possibly |goto reswitch|@>@; break; - case quoted_char: out(*(cur_tok++)); /* fall through */ + case quoted_char: out(*(cur_tok++)); @=/* fall through */@> case qualifier: break; default: out(a); /* otherwise |a| is an ordinary character */ } @@ -1598,7 +1598,7 @@ Section 233--234. case end_translation: return; case identifier: case res_word: @<Output an identifier@>@; break; case section_code: @<Output a section name@>@; break; - case math_rel: out_str("\\MRL{"@q}@>); /* fall through */ + case math_rel: out_str("\\MRL{"@q}@>); @=/* fall through */@> @.\\MRL@> case noop: case inserted: break; case cancel: case big_cancel: c=0; b=a; @@ -1620,11 +1620,11 @@ Section 233--234. if (a!=big_force) { out_str("\\1\\1"); goto reswitch; } - else dindent_pending=true; /* fall through */ + else dindent_pending=true; @=/* fall through */@> case indent: case outdent: case opt: case backup: case break_space: case force: case big_force: case preproc_line: @<Output a control, look ahead in case of line breaks, possibly |goto reswitch|@>@; break; - case quoted_char: out(*(cur_tok++)); /* fall through */ + case quoted_char: out(*(cur_tok++)); @=/* fall through */@> case qualifier: break; default: out(a); /* otherwise |a| is an ordinary character */ } @@ -1673,12 +1673,12 @@ Section 240. @x case ' ': case '\\': case '#': case '%': case '$': case '^': case '{': case '}': case '~': case '&': case '_': - out('\\'); /* falls through */ + out('\\'); @=/* falls through */@> @y case ' ': case '\\': case '#': case '%': @/ case '$': case '^': case '{': case '}': @/ case '~': case '&': case '_': @/ - out('\\'); /* falls through */ + out('\\'); @=/* falls through */@> @z Section 242. diff --git a/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch b/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch index 8b0ec0f7606..1a8da3c0b80 100644 --- a/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch @@ -1099,8 +1099,10 @@ flush_buffer(out_ptr,false,false); @z @x + } @=/* otherwise fall through */@> default: err_print("! Improper macro definition"); break; @y + } @=/* otherwise fall through */@> default: err_print(_("! Improper macro definition")); break; @z diff --git a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch index 80951343d37..2d9a5c24360 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch @@ -523,8 +523,10 @@ if (show_progress) fputs(_("\nWriting the output file..."),stdout); @z @x + } @=/* otherwise fall through */@> default: err_print("! Improper macro definition"); break; @y + } @=/* otherwise fall through */@> default: err_print(_("! Improper macro definition")); break; @z diff --git a/Build/source/texk/web2c/cwebdir/cweave.w b/Build/source/texk/web2c/cwebdir/cweave.w index 5db1c371b55..501528d4fe4 100644 --- a/Build/source/texk/web2c/cwebdir/cweave.w +++ b/Build/source/texk/web2c/cwebdir/cweave.w @@ -948,7 +948,7 @@ switch(ccode[c=*loc++]) { case verbatim: @<Scan a verbatim string@>@; case ord: @<Get a string@>@; case xref_roman: case xref_wildcard: case xref_typewriter: case noop: - case TeX_string: skip_restricted(); /* fall through */ + case TeX_string: skip_restricted(); @=/* fall through */@> default: return ccode[c]; } @@ -2535,10 +2535,12 @@ text_pointer p) if (name_dir[r].ilk==case_like) return case_found; if (name_dir[r].ilk==operator_like) return operator_found; if (name_dir[r].ilk!=raw_int) break; + @=/* else fall through */@> case 1: return j; case 4: case 5: /* |tok_flag| or |inner_tok_flag| */ if ((q=find_first_ident(tok_start+r))!=no_ident_found) return q; + @=/* else fall through */@> default: ; /* char, |section_flag|, fall thru: move on to next token */ if (*j==inserted) return no_ident_found; /* ignore inserts */ else if (*j==qualifier) j++; /* bypass namespace qualifier */ @@ -3919,7 +3921,7 @@ make_output(void) /* outputs the equivalents of tokens */ case end_translation: return; case identifier: case res_word: @<Output an identifier@>@; break; case section_code: @<Output a section name@>@; break; - case math_rel: out_str("\\MRL{"@q}@>); /* fall through */ + case math_rel: out_str("\\MRL{"@q}@>); @=/* fall through */@> @.\\MRL@> case noop: case inserted: break; case cancel: case big_cancel: c=0; b=a; @@ -3941,11 +3943,11 @@ make_output(void) /* outputs the equivalents of tokens */ if (a!=big_force) { out_str("\\1\\1"); goto reswitch; } - else dindent_pending=true; /* fall through */ + else dindent_pending=true; @=/* fall through */@> case indent: case outdent: case opt: case backup: case break_space: case force: case big_force: case preproc_line: @<Output a control, look ahead in case of line breaks, possibly |goto reswitch|@>@; break; - case quoted_char: out(*(cur_tok++)); /* fall through */ + case quoted_char: out(*(cur_tok++)); @=/* fall through */@> case qualifier: break; default: out(a); /* otherwise |a| is an ordinary character */ } @@ -4100,7 +4102,7 @@ while (k<k_limit) { switch (b) { case ' ': case '\\': case '#': case '%': case '$': case '^': case '{': case '}': case '~': case '&': case '_': - out('\\'); /* falls through */ + out('\\'); @=/* falls through */@> @.\\\ @> @.\\\\@> @.\\\#@> @@ -4353,7 +4355,7 @@ it starts after we scan the matching `\.)'. app_scrap(raw_int,no_math); if ((next_control=get_next())==')') { app(next_control); next_control=get_next(); break; - } /* otherwise fall through */ + } @=/* otherwise fall through */@> default: err_print("! Improper macro definition"); break; } app('$'); @@ -4786,6 +4788,7 @@ lowcase: out_str("\\\\"); case wildcard: out_str("\\9");@+ goto not_an_identifier; @.\\9@> case typewriter: out_str("\\."); + @=/* fall through */@> @.\\.@> case roman: not_an_identifier: out_name(cur_name,false); goto name_done; case custom: |