[gcc r17-2986] libga68: do not record the source directory in generated sources

"Jose E. Marchesi via Gcc-cvs" <[email protected]> Wed, 5 Aug 2026 15:19:17 +0000 (GMT)
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:e6cb892b0f437d5a43daf6cd812df8546c4254f1

commit r17-2986-ge6cb892b0f437d5a43daf6cd812df8546c4254f1
Author: Trevor Woerner <[email protected]>
Date:   Wed Aug 5 02:37:28 2026 -0400

    libga68: do not record the source directory in generated sources
    
    sppp.awk writes a header comment naming the file it was generated from,
    using awk's FILENAME. The makefile rule invokes it as
    
        $(AWK) -f $(srcdir)/sppp.awk $< > $@
    
    so FILENAME is $(srcdir)/standard.a68.in, and for an out-of-tree build
    with an absolute srcdir the resulting standard.a68 begins with
    
        { This is auto-generated from /abs/path/to/libga68/standard.a68.in.
          Do not edit.  }
    
    The content of a generated source therefore depends on where the tree
    was unpacked. That is a reproducibility problem in its own right, and it
    leaks the build directory into anything that ships the generated source,
    such as a distribution's debug-source package.
    
    Print only the file name, which is what the comment is for.
    
    Assisted by: Codex (Claude Opus 5)
    
    libga68/ChangeLog:
    
            * sppp.awk: Strip any directory prefix from FILENAME in the
            generated header comment.
    
    Signed-off-by: Trevor Woerner <[email protected]>

Diff:
---
 libga68/sppp.awk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libga68/sppp.awk b/libga68/sppp.awk
index 8ab94bac6363..97a2fb825b3e 100644
--- a/libga68/sppp.awk
+++ b/libga68/sppp.awk
@@ -29,7 +29,9 @@ BEGIN {
 }
 
 /^[ \t]*\{ Process this file/ {
-    print "{ This is auto-generated from " FILENAME ".  Do not edit.  }"
+    srcfile = FILENAME
+    sub (/^.*\//, "", srcfile)
+    print "{ This is auto-generated from " srcfile ".  Do not edit.  }"
     next
 }