]> git.saurik.com Git - bison.git/commitdiff
maint: style changes
authorAkim Demaille <akim@lrde.epita.fr>
Wed, 25 Jul 2012 15:57:57 +0000 (17:57 +0200)
committerAkim Demaille <akim@lrde.epita.fr>
Thu, 26 Jul 2012 10:28:17 +0000 (12:28 +0200)
* src/scan-code.l: Remove useless braces.
Formatting changes.
Prefer NULL to 0.
* src/muscle-tab.c, src/system.h: Formatting changes.

src/muscle-tab.c
src/muscle-tab.h
src/scan-code.l
src/system.h

index c916828540bc6d19aabbc639b450a42a5ecb0689..199049b5bd2276488c606916acfe0de603653bc4 100644 (file)
@@ -284,23 +284,23 @@ muscle_location_grow (char const *key, location loc)
   muscle_grow (key, "]]", "");
 }
 
-#define MUSCLE_COMMON_DECODE(Value)                                           \
-  case '$':                                                                   \
-    aver (*++(Value) == ']');                                                 \
-    aver (*++(Value) == '[');                                                 \
-    obstack_sgrow (&muscle_obstack, "$");                                     \
-    break;                                                                    \
-  case '@':                                                                   \
-    switch (*++(Value))                                                       \
-      {                                                                       \
-        case '@': obstack_sgrow (&muscle_obstack, "@" ); break;               \
-        case '{': obstack_sgrow (&muscle_obstack, "[" ); break;               \
-        case '}': obstack_sgrow (&muscle_obstack, "]" ); break;               \
-        default: aver (false); break;                                         \
-      }                                                                       \
-    break;                                                                    \
-  default:                                                                    \
-    obstack_1grow (&muscle_obstack, *(Value));                                \
+#define MUSCLE_COMMON_DECODE(Value)                             \
+  case '$':                                                     \
+    aver (*++(Value) == ']');                                   \
+    aver (*++(Value) == '[');                                   \
+    obstack_sgrow (&muscle_obstack, "$");                       \
+    break;                                                      \
+  case '@':                                                     \
+    switch (*++(Value))                                         \
+      {                                                         \
+        case '@': obstack_sgrow (&muscle_obstack, "@" ); break; \
+        case '{': obstack_sgrow (&muscle_obstack, "[" ); break; \
+        case '}': obstack_sgrow (&muscle_obstack, "]" ); break; \
+        default: aver (false); break;                           \
+      }                                                         \
+    break;                                                      \
+  default:                                                      \
+    obstack_1grow (&muscle_obstack, *(Value));                  \
     break;
 
 /* Reverse of MUSCLE_OBSTACK_SGROW.  */
index 74563ba5257fbde64cb1509cb3f210676c66fb54..6c658be6cc3f132433a2013f2ba5b6139a597dec 100644 (file)
@@ -35,62 +35,62 @@ void muscle_free (void);
 /* An obstack dedicated to receive muscle keys and values.  */
 extern struct obstack muscle_obstack;
 
-#define MUSCLE_INSERT_BOOL(Key, Value)                         \
-do {                                                           \
-  int v = Value;                                               \
-  MUSCLE_INSERT_INT (Key, v);                                  \
-} while(0)
-
-#define MUSCLE_INSERT_INT(Key, Value)                          \
-do {                                                           \
-  obstack_fgrow1 (&muscle_obstack, "%d", Value);               \
-  obstack_1grow (&muscle_obstack, 0);                          \
-  muscle_insert (Key, obstack_finish (&muscle_obstack));       \
-} while(0)
-
-#define MUSCLE_INSERT_LONG_INT(Key, Value)                     \
-do {                                                           \
-  obstack_fgrow1 (&muscle_obstack, "%ld", Value);              \
-  obstack_1grow (&muscle_obstack, 0);                          \
-  muscle_insert (Key, obstack_finish (&muscle_obstack));       \
-} while(0)
-
-#define MUSCLE_INSERT_STRING_RAW(Key, Value)                   \
-do {                                                           \
-  obstack_sgrow (&muscle_obstack, Value);                      \
-  obstack_1grow (&muscle_obstack, 0);                          \
-  muscle_insert (Key, obstack_finish (&muscle_obstack));       \
-} while(0)
-
-#define MUSCLE_INSERT_STRING(Key, Value)                       \
-do {                                                           \
-  MUSCLE_OBSTACK_SGROW (&muscle_obstack, Value);                \
-  obstack_1grow (&muscle_obstack, 0);                          \
-  muscle_insert (Key, obstack_finish (&muscle_obstack));       \
-} while(0)
-
-#define MUSCLE_OBSTACK_SGROW(Obstack, Value)                   \
-do {                                                           \
-  char const *p;                                               \
-  for (p = Value; *p; p++)                                     \
-    switch (*p)                                                        \
-      {                                                                \
-      case '$':        obstack_sgrow (Obstack, "$]["); break;          \
-      case '@':        obstack_sgrow (Obstack, "@@" ); break;          \
-      case '[':        obstack_sgrow (Obstack, "@{" ); break;          \
-      case ']':        obstack_sgrow (Obstack, "@}" ); break;          \
-      default: obstack_1grow (Obstack, *p); break;             \
-      }                                                                \
-} while(0)
-
-#define MUSCLE_INSERT_C_STRING(Key, Value)                     \
-do {                                                           \
-  MUSCLE_OBSTACK_SGROW (&muscle_obstack,                       \
-                       quotearg_style (c_quoting_style,        \
-                                       Value));                \
-  obstack_1grow (&muscle_obstack, 0);                          \
-  muscle_insert (Key, obstack_finish (&muscle_obstack));       \
-} while(0)
+#define MUSCLE_INSERT_BOOL(Key, Value)                          \
+  do {                                                          \
+    int v = Value;                                              \
+    MUSCLE_INSERT_INT (Key, v);                                 \
+  } while (0)
+
+#define MUSCLE_INSERT_INT(Key, Value)                           \
+  do {                                                          \
+    obstack_fgrow1 (&muscle_obstack, "%d", Value);              \
+    obstack_1grow (&muscle_obstack, 0);                         \
+    muscle_insert (Key, obstack_finish (&muscle_obstack));      \
+  } while (0)
+
+#define MUSCLE_INSERT_LONG_INT(Key, Value)                      \
+  do {                                                          \
+    obstack_fgrow1 (&muscle_obstack, "%ld", Value);             \
+    obstack_1grow (&muscle_obstack, 0);                         \
+    muscle_insert (Key, obstack_finish (&muscle_obstack));      \
+  } while (0)
+
+#define MUSCLE_INSERT_STRING_RAW(Key, Value)                    \
+  do {                                                          \
+    obstack_sgrow (&muscle_obstack, Value);                     \
+    obstack_1grow (&muscle_obstack, 0);                         \
+    muscle_insert (Key, obstack_finish (&muscle_obstack));      \
+  } while (0)
+
+#define MUSCLE_INSERT_STRING(Key, Value)                        \
+  do {                                                          \
+    MUSCLE_OBSTACK_SGROW (&muscle_obstack, Value);              \
+    obstack_1grow (&muscle_obstack, 0);                         \
+    muscle_insert (Key, obstack_finish (&muscle_obstack));      \
+  } while (0)
+
+#define MUSCLE_OBSTACK_SGROW(Obstack, Value)                    \
+  do {                                                          \
+    char const *p;                                              \
+    for (p = Value; *p; p++)                                    \
+      switch (*p)                                               \
+        {                                                       \
+        case '$': obstack_sgrow (Obstack, "$]["); break;        \
+        case '@': obstack_sgrow (Obstack, "@@" ); break;        \
+        case '[': obstack_sgrow (Obstack, "@{" ); break;        \
+        case ']': obstack_sgrow (Obstack, "@}" ); break;        \
+        default: obstack_1grow (Obstack, *p); break;            \
+        }                                                       \
+  } while (0)
+
+#define MUSCLE_INSERT_C_STRING(Key, Value)                      \
+  do {                                                          \
+    MUSCLE_OBSTACK_SGROW (&muscle_obstack,                      \
+                          quotearg_style (c_quoting_style,      \
+                                          Value));              \
+    obstack_1grow (&muscle_obstack, 0);                         \
+    muscle_insert (Key, obstack_finish (&muscle_obstack));      \
+  } while (0)
 
 /* Append VALUE to the current value of KEY.  If KEY did not already
    exist, create it.  Use MUSCLE_OBSTACK.  De-allocate the previously
@@ -110,7 +110,7 @@ void muscle_code_grow (const char *key, const char *value, location loc);
    muscle values are output *double* quoted, one needs to strip the first level
    of quotes to reach the list itself.  */
 void muscle_pair_list_grow (const char *muscle,
-                           const char *a1, const char *a2);
+                            const char *a1, const char *a2);
 
 /* In the format `[[file_name:line.column]], [[file_name:line.column]]', append
    LOC to MUSCLE.  Use digraphs for special characters in each file name.  */
index 5bcb56862ef710327f3fe7c0724d65f90ff40bef..785f386dc8f719af54b48ad72eb822acbf13e4c9 100644 (file)
@@ -181,19 +181,17 @@ ref      -?[0-9]+|{id}|"["{id}"]"|"$"
 <SC_RULE_ACTION>
 {
   "$"("<"{tag}">")?{ref}  {
-    ref_tail_fields = 0;
+    ref_tail_fields = NULL;
     handle_action_dollar (self->rule, yytext, *loc);
-    if (ref_tail_fields) {
+    if (ref_tail_fields)
       obstack_sgrow (&obstack_for_string, ref_tail_fields);
-    }
     need_semicolon = true;
   }
   "@"{ref} {
-    ref_tail_fields = 0;
+    ref_tail_fields = NULL;
     handle_action_at (self->rule, yytext, *loc);
-    if (ref_tail_fields) {
+    if (ref_tail_fields)
       obstack_sgrow (&obstack_for_string, ref_tail_fields);
-    }
     need_semicolon = true;
   }
   "$"  {
@@ -345,7 +343,7 @@ typedef struct
    not visible from current midrule. */
 #define VARIANT_NOT_VISIBLE_FROM_MIDRULE (1 << 2)
 
-static variant *variant_table = 0;
+static variant *variant_table = NULL;
 static unsigned variant_table_size = 0;
 static unsigned variant_count = 0;
 
@@ -367,7 +365,7 @@ static void
 variant_table_free (void)
 {
   free (variant_table);
-  variant_table = 0;
+  variant_table = NULL;
   variant_table_size = variant_count = 0;
 }
 
@@ -410,7 +408,7 @@ variant_add (uniqstr id, location id_loc, unsigned symbol_index,
 }
 
 static const char *
-get_at_spec(unsigned symbol_index)
+get_at_spec (unsigned symbol_index)
 {
   static char at_buf[20];
   if (symbol_index == 0)
@@ -826,7 +824,7 @@ handle_action_at (symbol_list *rule, char *text, location at_loc)
   locations_flag = true;
 
   n = parse_ref (cp, effective_rule, effective_rule_length,
-                      rule->midrule_parent_rhs_index, text, at_loc, '@');
+                 rule->midrule_parent_rhs_index, text, at_loc, '@');
   switch (n)
     {
     case INVALID_REF:
index d3c544b4720a36dea8a132feb3b407ab9293e7de..da3c97ed0606782022281b3fd9a8a31cd9fd5e1a 100644 (file)
@@ -160,36 +160,36 @@ typedef size_t uintptr_t;
 # define obstack_chunk_free  free
 # include <obstack.h>
 
-# define obstack_sgrow(Obs, Str) \
+# define obstack_sgrow(Obs, Str)                \
   obstack_grow (Obs, Str, strlen (Str))
 
-# define obstack_fgrow1(Obs, Format, Arg1)     \
-do {                                           \
-  char buf[4096];                              \
-  sprintf (buf, Format, Arg1);                 \
-  obstack_grow (Obs, buf, strlen (buf));       \
-} while (0)
+# define obstack_fgrow1(Obs, Format, Arg1)      \
+  do {                                          \
+    char buf[4096];                             \
+    sprintf (buf, Format, Arg1);                \
+    obstack_grow (Obs, buf, strlen (buf));      \
+  } while (0)
 
-# define obstack_fgrow2(Obs, Format, Arg1, Arg2)       \
-do {                                           \
-  char buf[4096];                              \
-  sprintf (buf, Format, Arg1, Arg2);           \
-  obstack_grow (Obs, buf, strlen (buf));       \
-} while (0)
+# define obstack_fgrow2(Obs, Format, Arg1, Arg2)        \
+  do {                                                  \
+    char buf[4096];                                     \
+    sprintf (buf, Format, Arg1, Arg2);                  \
+    obstack_grow (Obs, buf, strlen (buf));              \
+  } while (0)
 
-# define obstack_fgrow3(Obs, Format, Arg1, Arg2, Arg3) \
-do {                                                   \
-  char buf[4096];                                      \
-  sprintf (buf, Format, Arg1, Arg2, Arg3);             \
-  obstack_grow (Obs, buf, strlen (buf));               \
-} while (0)
+# define obstack_fgrow3(Obs, Format, Arg1, Arg2, Arg3)  \
+  do {                                                  \
+    char buf[4096];                                     \
+    sprintf (buf, Format, Arg1, Arg2, Arg3);            \
+    obstack_grow (Obs, buf, strlen (buf));              \
+  } while (0)
 
-# define obstack_fgrow4(Obs, Format, Arg1, Arg2, Arg3, Arg4)   \
-do {                                                           \
-  char buf[4096];                                              \
-  sprintf (buf, Format, Arg1, Arg2, Arg3, Arg4);               \
-  obstack_grow (Obs, buf, strlen (buf));                       \
-} while (0)
+# define obstack_fgrow4(Obs, Format, Arg1, Arg2, Arg3, Arg4)    \
+  do {                                                          \
+    char buf[4096];                                             \
+    sprintf (buf, Format, Arg1, Arg2, Arg3, Arg4);              \
+    obstack_grow (Obs, buf, strlen (buf));                      \
+  } while (0)
 
 
 
@@ -215,15 +215,15 @@ do {                                                              \
 | Free a linked list.  |
 `---------------------*/
 
-# define LIST_FREE(Type, List)                 \
-do {                                           \
-  Type *_node, *_next;                         \
-  for (_node = List; _node; _node = _next)     \
-                                             \
-      _next = _node->next;                     \
-      free (_node);                            \
-                                             \
-} while (0)
+# define LIST_FREE(Type, List)                  \
+  do {                                          \
+    Type *_node, *_next;                        \
+    for (_node = List; _node; _node = _next)    \
+      {                                         \
+        _next = _node->next;                    \
+        free (_node);                           \
+      }                                         \
+  } while (0)
 
 
 /*---------------------------------------------.