diff options
author | Andreas Scherer <andreas_tex@freenet.de> | 2022-02-14 16:00:50 +0000 |
---|---|---|
committer | Andreas Scherer <andreas_tex@freenet.de> | 2022-02-14 16:00:50 +0000 |
commit | dc54dfddee8aa51b8c0747c467abe3f6bed18309 (patch) | |
tree | d1cbf607da38a090f8d80f0ca2f68d76b31114cd /Build/source/texk/web2c/cwebdir/ctangle.w | |
parent | 08a57555563d6b19cb9bb66b168671033672f7aa (diff) |
[CWEB] Add '#line' after '#endif'.
Some people incorporate '@<Section code@>' in preprocessor #if-blocks.
(AFAIKS, DEK did this exactly _once_ in his 'reflect.w' example code,
but never in any larger system program.) This adds material (lines of
code) in the ctangle'd C code wrapped in '#line' directives for the
benefit of the compiler/debugger/w.h.y. Depending on the #if-condition,
the #line directives in the #if-block get eliminated and the resulting
status from previous #line directives kicks the compiler (__LINE__ and
possibly __FILE__) and the debugger (e.g., gdb, MSVS) off the track.
git-svn-id: svn://tug.org/texlive/trunk@62021 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/cwebdir/ctangle.w')
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctangle.w | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Build/source/texk/web2c/cwebdir/ctangle.w b/Build/source/texk/web2c/cwebdir/ctangle.w index 1ee2aaf1958..a49869b4dc6 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.w +++ b/Build/source/texk/web2c/cwebdir/ctangle.w @@ -1242,7 +1242,11 @@ file name. } @ @<In cases that |a| is...@>=@t\1\quad@> -case identifier: store_id(a); break; +case identifier: store_id(a); + if (*buffer=='#' && id_first==buffer+1 && id_loc-id_first==5 + && strncmp("endif",id_first,5)==0) + @<Insert the line number into |tok_mem|@>@; + break; case section_name: if (t!=section_name) goto done; else { @<Was an `\.{@@}' missed here?@>@; |