On Sat, 2025-02-15 at 16:01 -0500, James K. Lowden wrote:
> From 5d53920602e234e4d99ae2d502e662ee3699978e 4 Oct 2024 12:01:22 -
> 0400
> From: "James K. Lowden" <[email protected]>
> Date: Sat 15 Feb 2025 12:50:53 PM EST
> Subject: [PATCH] 9 new 'cobol' FE files
>
> gcc/cobol/ChangeLog
> * cdf.y: New file.
> * cobol1.cc: New file.
> * convert.cc: New file.
> * except.cc: New file.
> * gcobolspec.cc: New file.
> * structs.cc: New file.
> * symbols.cc: New file.
> * symfind.cc: New file.
> * util.cc: New file.
+/* Get a value for the SARIF v2.1.0 "artifact.sourceLanguage" property,
+ based on the list in SARIF v2.1.0 Appendix J. */
+
+const char *
+cobol_get_sarif_source_language(const char *)
+ {
+ return "cobol";
+ }
Out of curiosity, did you try the SARIF output? This is a good test
for whether you’re properly using the GCC diagnostics subsystem.
+void
+yyerror( const char gmsgid[], ... ) {
+ temp_loc_t looker;
+ verify_format(gmsgid);
+ parse_error_inc();
+ global_dc->begin_group();
+ va_list ap;
+ va_start (ap, gmsgid);
+ rich_location richloc (line_table, token_location);
+ bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_id,
+ gmsgid, &ap, DK_ERROR);
+ va_end (ap);
+ global_dc->end_group();
+}
For errors, just pass 0 as the diagnostic_option_id. Same for the
various DK_SORRY and DK_FATAL.
+bool
+yywarn( const char gmsgid[], ... ) {
+ verify_format(gmsgid);
+ auto_diagnostic_group d;
+ va_list ap;
+ va_start (ap, gmsgid);
+ auto ret = emit_diagnostic_valist( DK_WARNING, token_location,
+ option_id, gmsgid, &ap );
+ va_end (ap);
+ return ret;
+}
For warnings, ideally this should take a diagnostic_option_id
controlling the warning as the initial parameter, rather than have a
global variable for this. Is this something that yacc is imposing on
you?
Hope this is constructive
Dave