bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

diagnostics: style changes


From: Akim Demaille
Subject: diagnostics: style changes
Date: Sat, 7 Dec 2019 08:38:28 +0100

commit 9e9e49224fb4a7fae7b98205e1165fbfcea2453f
Author: Akim Demaille <address@hidden>
Date:   Mon Dec 2 18:56:46 2019 +0100

    diagnostics: style changes
    
    * src/complain.h, src/complain.c: Comment changes.
    * src/scan-skel.l: Reduce scopes.
    * data/skeletons/bison.m4: Factor diagnostic functions.

diff --git a/data/skeletons/bison.m4 b/data/skeletons/bison.m4
index 0fe0dc80..7cc4467b 100644
--- a/data/skeletons/bison.m4
+++ b/data/skeletons/bison.m4
@@ -192,7 +192,7 @@ m4_define([b4_error],
 #   @warn(1@)
 #   @warn(1@,2@)
 m4_define([b4_warn],
-[b4_error([[warn]], [], [], $@)])
+[b4_warn_at([], [], $@)])
 
 # b4_warn_at(START, END, FORMAT, [ARG1], [ARG2], ...)
 # ---------------------------------------------------
@@ -210,7 +210,7 @@ m4_define([b4_warn_at],
 #
 # See b4_warn example.
 m4_define([b4_complain],
-[b4_error([[complain]], [], [], $@)])
+[b4_complain_at([], [], $@)])
 
 # b4_complain_at(START, END, FORMAT, [ARG1], [ARG2], ...)
 # -------------------------------------------------------
@@ -226,8 +226,7 @@ m4_define([b4_complain_at],
 #
 # See b4_warn example.
 m4_define([b4_fatal],
-[b4_error([[fatal]], [], [], $@)dnl
-m4_exit(1)])
+[b4_fatal_at([], [], $@)])
 
 # b4_fatal_at(START, END, FORMAT, [ARG1], [ARG2], ...)
 # ----------------------------------------------------
diff --git a/src/complain.c b/src/complain.c
index d945d583..7177a2b9 100644
--- a/src/complain.c
+++ b/src/complain.c
@@ -225,6 +225,7 @@ warnings_argmatch (char *args)
         }
 }
 
+/* Color style for this type of message.  */
 static const char*
 severity_style (severity s)
 {
@@ -242,6 +243,7 @@ severity_style (severity s)
   abort ();
 }
 
+/* Prefix for this type of message.  */
 static const char*
 severity_prefix (severity s)
 {
diff --git a/src/complain.h b/src/complain.h
index 5d112c23..bc48d2f1 100644
--- a/src/complain.h
+++ b/src/complain.h
@@ -61,6 +61,7 @@ typedef enum
 /** Whether -Werror was set. */
 extern bool warnings_are_errors;
 
+/** Document --warning arguments.  */
 void warning_usage (FILE *out);
 
 /** Decode a single argument from -W.
@@ -99,6 +100,7 @@ void complain_free (void);
 /** Initialize support for colored messages.  */
 void complain_init_color (void);
 
+/** Flags passed to diagnostics functions.  */
 typedef enum
   {
     Wnone             = 0,       /**< Issue no warnings.  */
diff --git a/src/scan-skel.l b/src/scan-skel.l
index 0303b494..121aac07 100644
--- a/src/scan-skel.l
+++ b/src/scan-skel.l
@@ -209,22 +209,23 @@ at_basename (int argc, char *argv[], char **out_namep, 
int *out_linenop)
 static void
 at_complain (int argc, char *argv[], char **out_namep, int *out_linenop)
 {
-  static int indent;
-  warnings w = flag (argv[1]);
-  location loc;
-  location *locp = NULL;
+  if (argc < 4)
+    fail_for_at_directive_too_few_args (argv[0]);
 
   (void) out_namep;
   (void) out_linenop;
 
-  if (argc < 4)
-    fail_for_at_directive_too_few_args (argv[0]);
+  warnings w = flag (argv[1]);
+
+  location loc;
+  location *locp = NULL;
   if (argv[2] && argv[2][0])
     {
       boundary_set_from_string (&loc.start, argv[2]);
       boundary_set_from_string (&loc.end, argv[3]);
       locp = &loc;
     }
+  static int indent;
   if (w & silent)
     indent += SUB_INDENT;
   else




reply via email to

[Prev in Thread] Current Thread [Next in Thread]