diff --git a/gcc/cobol/Make-lang.in b/gcc/cobol/Make-lang.in index 358a793a50cec35c4b1eab5195c854f2ffe28b6a..cc37639e295e5d0ac08a1f4331c8257cc93bb40c 100644 --- a/gcc/cobol/Make-lang.in +++ b/gcc/cobol/Make-lang.in @@ -150,16 +150,6 @@ gcobol$(exeext): \ # First, files needed for parsing: -# To establish prerequisites for parse.o, cdf.o, and scan.o, -# 1. capture the "make -n" output -# 2. eliminate compiler options, leaving only preprocessor options (-D and -I) -# 3. add -E -MM -# -# 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. -# cobol/parse.c: cobol/parse.y $(BISON) -o $@ $(YFLAGS) \ --defines=cobol/parse.h \ @@ -169,6 +159,20 @@ cobol/cdf.c: cobol/cdf.y $(BISON) -o $@ $(YFLAGS) \ --defines=cobol/cdf.h --report-file=cobol/cdf.out $< + +# The src<foo> targets are executed if +# ‘--enable-generated-files-in-srcdir’ was specified as a configure +# option. +# +# srcextra copies generated dependencies into the source +# directory. This is used for files such as Flex/Bison output: files +# that are not version-controlled but should be included in any +# release tarballs. +# +# Although versioned snapshots require Flex to be installed, they do +# 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 ln -f $^ cobol/parse.h cobol/cdf.h $(srcdir)/cobol/ @@ -183,6 +187,17 @@ cobol/scan.c: cobol/scan.l exit nerr}' $@~ @rm $@~ + +# To establish prerequisites for parse.o, cdf.o, and scan.o, +# 1. capture the "make -n" output +# 2. eliminate compiler options, leaving only preprocessor options (-D and -I) +# 3. add -E -MM +# +# 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. + cobol/cdf.o: cobol/cdf.c \ $(srcdir)/cobol/cbldiag.h \ $(srcdir)/cobol/cdfval.h \ diff --git a/gcc/cobol/cbldiag.h b/gcc/cobol/cbldiag.h index bfc72f3921390a7194a53fdd8adf8bbd834906b3..7fc479da151e43d485b8d865f86c5eaf9ecf3402 100644 --- a/gcc/cobol/cbldiag.h +++ b/gcc/cobol/cbldiag.h @@ -73,8 +73,7 @@ struct YDFLTYPE #endif // an error at a location, called from the parser for semantic errors -template <typename LOC> -void error_msg( const LOC& loc, const char gmsgid[], ... ); +void error_msg( const YYLTYPE& loc, const char gmsgid[], ... ); void dialect_error( const YYLTYPE& loc, const char term[], const char dialect[] ); @@ -96,8 +95,7 @@ void cbl_unimplemented_at( const YYLTYPE& loc, const char *gmsgid, ... ); void dbgerr( const char fmt[], ... ); void dbgmsg( const char fmt[], ... ); -template <typename LOC> -void gcc_location_set( const LOC& loc ); +void gcc_location_set( const YYLTYPE& loc ); // tree.h defines yy_flex_debug as a macro because options.h #if ! defined(yy_flex_debug) @@ -110,6 +108,6 @@ location_dump( const char func[], int line, const char tag[], const LOC& loc) { func, line, tag, loc.first_line, loc.first_column, loc.last_line, loc.last_column); } -#endif +#endif // defined(yy_flex_debug) #endif diff --git a/gcc/cobol/gcobol.1 b/gcc/cobol/gcobol.1 index 0d3898818c7b20e328943317ae6ae446724dee57..415ad36aa786398ae69a91148ea9ebfdfff5a411 100644 --- a/gcc/cobol/gcobol.1 +++ b/gcc/cobol/gcobol.1 @@ -98,7 +98,7 @@ to have the value of .Ar expr . .It Fl E Write the CDF-processed \*[lang] input to standard output in free-form -reference format. Certain non-\*[lang] markers are included in the +reference format. Certain non-\*[lang] markers are included in the output to indicate where copybook files were included. For line-number consistency with the input, blank lines are retained. .Pp @@ -308,7 +308,7 @@ the primary source file. If .Ar filename is not an absolute path, the directory searched is the current working directory, not the directory containing the main source file. The -name is used verbatim. No permutations are applied, and no +name is used verbatim. No permutations are applied, and no directories searched. .Pp If multiple diff --git a/gcc/cobol/util.cc b/gcc/cobol/util.cc index 5891ae853dd15f057ec2f8599ac982b7dd23b8f7..4737187497302b4af632fb7e903789c8107e5f6b 100644 --- a/gcc/cobol/util.cc +++ b/gcc/cobol/util.cc @@ -1920,8 +1920,8 @@ cobol_filename_restore() { static location_t token_location; template <typename LOC> -void -gcc_location_set( const LOC& loc ) { +static void +gcc_location_set_impl( const LOC& loc ) { token_location = linemap_line_start( line_table, loc.last_line, 80 ); token_location = linemap_position_for_column( line_table, loc.first_column); location_dump(__func__, __LINE__, "parser", loc); @@ -2007,20 +2007,9 @@ class temp_loc_t : protected YYLTYPE { } }; -// These uses of the error_msg function are never invoked, but encourage the -// compiler to instantiate the templates. -namespace none { - void foo() { - error_msg(YYLTYPE(), "fake"); - error_msg(YDFLTYPE(), "also fake"); - gcc_location_set(YYLTYPE()); - gcc_location_set(YDFLTYPE()); - } -}; - template <typename LOC> void -error_msg( const LOC& loc, const char gmsgid[], ... ) { +static error_msg_impl( const LOC& loc, const char gmsgid[], ... ) { temp_loc_t looker(loc); verify_format(gmsgid); parse_error_inc(); @@ -2034,6 +2023,22 @@ error_msg( const LOC& loc, const char gmsgid[], ... ) { global_dc->end_group(); } +void error_msg( const YYLTYPE& loc, const char gmsgid[], ... ) { + error_msg_impl(loc, gmsgid); +} + +void error_msg( const YDFLTYPE& loc, const char gmsgid[], ... ) { + error_msg_impl(loc, gmsgid); +} + +void gcc_location_set( const YYLTYPE& loc ) { + gcc_location_set_impl(loc); +} + +void gcc_location_set( const YDFLTYPE& loc ) { + gcc_location_set_impl(loc); +} + void cdf_location_set(YYLTYPE loc) { extern YDFLTYPE ydflloc;