https://gcc.gnu.org/g:3f717f9565c5c40bcaa1e0b5419fe5bf65ad7f1c
commit r15-7949-g3f717f9565c5c40bcaa1e0b5419fe5bf65ad7f1c
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Tue Mar 11 11:07:15 2025 +0100

    cobol: Use *.cc suffix for bison/flex generated C++ files
    
    In GCC 12 we've switched to using *.cc suffixes for C++ sources in GCC
    sources, including generated files, instead of using *.c suffixes and
    compiling them as C++ anyway (that was the case since we've switched
    GCC to C++ in GCC 4.8).
    I've noticed gcc/cobol has 3 generated files still with c extension
    despite clearly having C++ code in it and being compiled as C++.
    
    2025-03-11  Jakub Jelinek  <ja...@redhat.com>
    
            * Make-lang.in (cobol/parse.c, cobol/cdf.c, cobol/scan.c): Remove.
            (cobol/parse.cc, cobol/cdf.cc, cobol/scan.cc): New goals.
            (cobol/cdf.o): Depend on cobol/cdf.cc rather than cobol/cdf.c.
            (cobol/parse.o): Depend on cobol/parse.cc rather than cobol/parse.c.
            (cobol/scan.o): Depend on cobol/scan.cc rather than cobol/scan.c,
            on cobol/cdf.cc rather than cobol/cdf.c and on cobol/parse.cc rather
            than cobol/parse.c.
            (cobol.srcextra): Depend on cobol/parse.cc cobol/cdf.cc 
cobol/scan.cc
            rather than cobol/parse.c cobol/cdf.c cobol/scan.c.

Diff:
---
 gcc/cobol/Make-lang.in | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/gcc/cobol/Make-lang.in b/gcc/cobol/Make-lang.in
index 8cc837eabf39..1d98c25342a9 100644
--- a/gcc/cobol/Make-lang.in
+++ b/gcc/cobol/Make-lang.in
@@ -150,12 +150,12 @@ gcobol$(exeext): \
 
 # First, files needed for parsing:
 
-cobol/parse.c: cobol/parse.y
+cobol/parse.cc: cobol/parse.y
        $(BISON) -o $@ $(YFLAGS)                                \
                --defines=cobol/parse.h                 \
                --report-file=cobol/parser.out $<
 
-cobol/cdf.c: cobol/cdf.y
+cobol/cdf.cc: cobol/cdf.y
        $(BISON) -o $@ $(YFLAGS)                                                
\
                --defines=cobol/cdf.h --report-file=cobol/cdf.out $<
 
@@ -163,7 +163,7 @@ cobol/cdf.c: cobol/cdf.y
 # in Flex manual. We suppress those messages, as a convenience.
 FLEX_WARNING = warning, dangerous trailing context
 
-cobol/scan.c: cobol/scan.l
+cobol/scan.cc: cobol/scan.l
        $(FLEX) -o$@ $(LFLAGS) $< >$@~ 2>&1
        awk  '! /$(FLEX_WARNING)/ {print > "/dev/stderr"; nerr++}       \
             END {print "$(FLEX):", NR, "messages" > "/dev/stderr";     \
@@ -179,9 +179,9 @@ cobol/scan.c: cobol/scan.l
 # The below lists of include files for the the generated files is
 # postprocessed: the files are one per line, used "realpath
 # --relative-to=$PWD" to rationalize them, and sorted.  We include
-# parse.c in the list for scan.o because that's the one make(1) knows about.
+# parse.cc in the list for scan.o because that's the one make(1) knows about.
 
-cobol/cdf.o: cobol/cdf.c                       \
+cobol/cdf.o: cobol/cdf.cc                      \
        $(srcdir)/cobol/cbldiag.h               \
        $(srcdir)/cobol/cdfval.h                \
        $(srcdir)/cobol/copybook.h              \
@@ -192,7 +192,7 @@ cobol/cdf.o: cobol/cdf.c                    \
        $(srcdir)/../libgcobol/ec.h             \
        $(srcdir)/../libgcobol/exceptl.h
 
-cobol/parse.o: cobol/parse.c                   \
+cobol/parse.o: cobol/parse.cc                  \
        $(srcdir)/cobol/cbldiag.h               \
        $(srcdir)/cobol/cdfval.h                \
        $(srcdir)/cobol/cobol-system.h          \
@@ -217,7 +217,7 @@ cobol/parse.o: cobol/parse.c                        \
        auto-host.h                             \
        config.h
 
-cobol/scan.o: cobol/scan.c                     \
+cobol/scan.o: cobol/scan.cc                    \
        $(srcdir)/cobol/cbldiag.h               \
        $(srcdir)/cobol/cdfval.h                \
        $(srcdir)/cobol/cobol-system.h          \
@@ -243,8 +243,8 @@ cobol/scan.o: cobol/scan.c                  \
        $(srcdir)/../libgcobol/io.h             \
        auto-host.h                             \
        config.h                                \
-       cobol/cdf.c                             \
-       cobol/parse.c
+       cobol/cdf.cc                            \
+       cobol/parse.cc
 
 #
 # The src<foo> targets are executed if
@@ -260,7 +260,7 @@ cobol/scan.o: cobol/scan.c                  \
 # not require Bison.  Release tarballs always include Flex/Bison
 # output, and do not require those tools to be installed.
 #
-cobol.srcextra: cobol/parse.c cobol/cdf.c cobol/scan.c
+cobol.srcextra: cobol/parse.cc cobol/cdf.cc cobol/scan.cc
        ln -f $^ cobol/parse.h cobol/cdf.h $(srcdir)/cobol/

Reply via email to