style changes: run cppi

Run it in src/ for a start.

* src/AnnotationList.h, src/InadequacyList.h, src/Sbitset.h,
* src/closure.c, src/complain.h, src/flex-scanner.h, src/getargs.h,
* src/gram.h, src/graphviz.h, src/ielr.h, src/location.h,
* src/muscle-tab.h, src/named-ref.h, src/relation.h, src/scan-code.h,
* src/state.h, src/symtab.h, src/system.h, src/uniqstr.h:
Reindent preprocessor directives.
This commit is contained in:
Akim Demaille
2012-12-21 16:45:30 +01:00
parent 975bdced50
commit a99ec53eb1
19 changed files with 176 additions and 176 deletions

View File

@@ -20,10 +20,10 @@
#ifndef ANNOTATION_LIST_H_ #ifndef ANNOTATION_LIST_H_
# define ANNOTATION_LIST_H_ # define ANNOTATION_LIST_H_
#include <bitsetv.h> # include <bitsetv.h>
#include "Sbitset.h" # include "Sbitset.h"
#include "InadequacyList.h" # include "InadequacyList.h"
#include "state.h" # include "state.h"
typedef unsigned int AnnotationIndex; typedef unsigned int AnnotationIndex;

View File

@@ -20,10 +20,10 @@
#ifndef INADEQUACY_LIST_H_ #ifndef INADEQUACY_LIST_H_
# define INADEQUACY_LIST_H_ # define INADEQUACY_LIST_H_
#include <bitset.h> # include <bitset.h>
#include "gram.h" # include "gram.h"
#include "state.h" # include "state.h"
#include "symtab.h" # include "symtab.h"
/** /**
* A unique ID assigned to every \c InadequacyList node. * A unique ID assigned to every \c InadequacyList node.

View File

@@ -22,15 +22,15 @@
typedef unsigned char *Sbitset; typedef unsigned char *Sbitset;
typedef size_t Sbitset__Index; typedef size_t Sbitset__Index;
#define SBITSET__INDEX__CONVERSION_SPEC "zu" # define SBITSET__INDEX__CONVERSION_SPEC "zu"
#define Sbitset__nbytes(NBITS) \ # define Sbitset__nbytes(NBITS) \
(((NBITS) + CHAR_BIT - 1) / CHAR_BIT) (((NBITS) + CHAR_BIT - 1) / CHAR_BIT)
#define Sbitset__byteAddress(SELF, INDEX) \ # define Sbitset__byteAddress(SELF, INDEX) \
(((SELF) + (INDEX) / CHAR_BIT)) (((SELF) + (INDEX) / CHAR_BIT))
#define Sbitset__bit_mask(INDEX) \ # define Sbitset__bit_mask(INDEX) \
(1 << (CHAR_BIT - 1 - (INDEX) % CHAR_BIT)) (1 << (CHAR_BIT - 1 - (INDEX) % CHAR_BIT))
#define Sbitset__last_byte_mask(NBITS) \ # define Sbitset__last_byte_mask(NBITS) \
(UCHAR_MAX << (CHAR_BIT - 1 - ((NBITS) - 1) % CHAR_BIT)) (UCHAR_MAX << (CHAR_BIT - 1 - ((NBITS) - 1) % CHAR_BIT))
/* nbits must not be 0. */ /* nbits must not be 0. */
@@ -39,54 +39,54 @@ Sbitset Sbitset__new_on_obstack (Sbitset__Index nbits,
struct obstack *obstackp); struct obstack *obstackp);
void Sbitset__delete (Sbitset self); void Sbitset__delete (Sbitset self);
#define Sbitset__test(SELF, INDEX) \ # define Sbitset__test(SELF, INDEX) \
((*Sbitset__byteAddress ((SELF), (INDEX)) & Sbitset__bit_mask (INDEX)) != 0) ((*Sbitset__byteAddress ((SELF), (INDEX)) & Sbitset__bit_mask (INDEX)) != 0)
bool Sbitset__isEmpty (Sbitset self, Sbitset__Index nbits); bool Sbitset__isEmpty (Sbitset self, Sbitset__Index nbits);
void Sbitset__fprint(Sbitset self, Sbitset__Index nbits, FILE *file); void Sbitset__fprint(Sbitset self, Sbitset__Index nbits, FILE *file);
#define Sbitset__set(SELF, INDEX) \ # define Sbitset__set(SELF, INDEX) \
do { \ do { \
*Sbitset__byteAddress ((SELF), (INDEX)) = \ *Sbitset__byteAddress ((SELF), (INDEX)) = \
*Sbitset__byteAddress ((SELF), (INDEX)) | Sbitset__bit_mask (INDEX); \ *Sbitset__byteAddress ((SELF), (INDEX)) | Sbitset__bit_mask (INDEX); \
} while(0) } while(0)
#define Sbitset__reset(SELF, INDEX) \ # define Sbitset__reset(SELF, INDEX) \
do { \ do { \
*Sbitset__byteAddress ((SELF), (INDEX)) = \ *Sbitset__byteAddress ((SELF), (INDEX)) = \
*Sbitset__byteAddress ((SELF), (INDEX)) & ~Sbitset__bit_mask (INDEX); \ *Sbitset__byteAddress ((SELF), (INDEX)) & ~Sbitset__bit_mask (INDEX); \
} while(0) } while(0)
/* NBITS is the size of the bitset. More than NBITS bits might be reset. */ /* NBITS is the size of the bitset. More than NBITS bits might be reset. */
#define Sbitset__zero(SELF, NBITS) \ # define Sbitset__zero(SELF, NBITS) \
do { \ do { \
memset (SELF, 0, Sbitset__nbytes (NBITS)); \ memset (SELF, 0, Sbitset__nbytes (NBITS)); \
} while(0) } while(0)
/* NBITS is the size of the bitset. More than NBITS bits might be set. */ /* NBITS is the size of the bitset. More than NBITS bits might be set. */
#define Sbitset__ones(SELF, NBITS) \ # define Sbitset__ones(SELF, NBITS) \
do { \ do { \
memset (SELF, UCHAR_MAX, Sbitset__nbytes (NBITS)); \ memset (SELF, UCHAR_MAX, Sbitset__nbytes (NBITS)); \
} while(0) } while(0)
/* NBITS is the size of every bitset. More than NBITS bits might be set. */ /* NBITS is the size of every bitset. More than NBITS bits might be set. */
#define Sbitset__or(SELF, OTHER1, OTHER2, NBITS) \ # define Sbitset__or(SELF, OTHER1, OTHER2, NBITS) \
do { \ do { \
Sbitset ptr_self = (SELF); \ Sbitset ptr_self = (SELF); \
Sbitset ptr_other1 = (OTHER1); \ Sbitset ptr_other1 = (OTHER1); \
Sbitset ptr_other2 = (OTHER2); \ Sbitset ptr_other2 = (OTHER2); \
Sbitset end_self = ptr_self + Sbitset__nbytes (NBITS); \ Sbitset end_self = ptr_self + Sbitset__nbytes (NBITS); \
for (; ptr_self < end_self; ++ptr_self, ++ptr_other1, ++ptr_other2) \ for (; ptr_self < end_self; ++ptr_self, ++ptr_other1, ++ptr_other2) \
*ptr_self = *ptr_other1 | *ptr_other2; \ *ptr_self = *ptr_other1 | *ptr_other2; \
} while(0) } while(0)
#define SBITSET__FOR_EACH(SELF, NBITS, ITER, INDEX) \ # define SBITSET__FOR_EACH(SELF, NBITS, ITER, INDEX) \
for ((ITER) = (SELF); (ITER) < (SELF) + Sbitset__nbytes (NBITS); ++(ITER)) \ for ((ITER) = (SELF); (ITER) < (SELF) + Sbitset__nbytes (NBITS); ++(ITER)) \
if (*(ITER) != 0) \ if (*(ITER) != 0) \
for ((INDEX) = ((ITER)-(SELF))*CHAR_BIT; \ for ((INDEX) = ((ITER)-(SELF))*CHAR_BIT; \
(INDEX) < (NBITS) && (SELF)+(INDEX)/CHAR_BIT < (ITER)+1; \ (INDEX) < (NBITS) && (SELF)+(INDEX)/CHAR_BIT < (ITER)+1; \
++(INDEX)) \ ++(INDEX)) \
if (((*ITER) & Sbitset__bit_mask (INDEX)) != 0) if (((*ITER) & Sbitset__bit_mask (INDEX)) != 0)
#endif /* !SBITSET_H_ */ #endif /* !SBITSET_H_ */

View File

@@ -44,7 +44,7 @@ static bitsetv firsts = NULL;
/* Retrieve the FDERIVES/FIRSTS sets of the nonterminals numbered Var. */ /* Retrieve the FDERIVES/FIRSTS sets of the nonterminals numbered Var. */
#define FDERIVES(Var) fderives[(Var) - ntokens] #define FDERIVES(Var) fderives[(Var) - ntokens]
#define FIRSTS(Var) firsts[(Var) - ntokens] #define FIRSTS(Var) firsts[(Var) - ntokens]
/*-----------------. /*-----------------.

View File

@@ -22,7 +22,7 @@
# include "location.h" # include "location.h"
/* Sub-messages indent. */ /* Sub-messages indent. */
#define SUB_INDENT (4) # define SUB_INDENT (4)
/*-------------. /*-------------.
| --warnings. | | --warnings. |

View File

@@ -28,7 +28,7 @@
+ (YY_FLEX_SUBMINOR_VERSION)) + (YY_FLEX_SUBMINOR_VERSION))
/* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */ /* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */
# if FLEX_VERSION <= 2005031 #if FLEX_VERSION <= 2005031
int FLEX_PREFIX (get_lineno) (void); int FLEX_PREFIX (get_lineno) (void);
FILE *FLEX_PREFIX (get_in) (void); FILE *FLEX_PREFIX (get_in) (void);
FILE *FLEX_PREFIX (get_out) (void); FILE *FLEX_PREFIX (get_out) (void);

View File

@@ -21,7 +21,7 @@
#ifndef GETARGS_H_ #ifndef GETARGS_H_
# define GETARGS_H_ # define GETARGS_H_
#include "location.h" # include "location.h"
enum { command_line_prio, grammar_prio, default_prio }; enum { command_line_prio, grammar_prio, default_prio };

View File

@@ -113,7 +113,7 @@ extern int ntokens;
extern int nvars; extern int nvars;
typedef int item_number; typedef int item_number;
#define ITEM_NUMBER_MAX INT_MAX # define ITEM_NUMBER_MAX INT_MAX
extern item_number *ritem; extern item_number *ritem;
extern unsigned int nritems; extern unsigned int nritems;
@@ -145,7 +145,7 @@ item_number_is_symbol_number (item_number i)
/* Rule numbers. */ /* Rule numbers. */
typedef int rule_number; typedef int rule_number;
#define RULE_NUMBER_MAX INT_MAX # define RULE_NUMBER_MAX INT_MAX
extern rule_number nrules; extern rule_number nrules;
static inline item_number static inline item_number

View File

@@ -22,7 +22,7 @@
#ifndef GRAPHVIZ_H_ #ifndef GRAPHVIZ_H_
# define GRAPHVIZ_H_ # define GRAPHVIZ_H_
#include "state.h" # include "state.h"
/** Begin a Dot graph. /** Begin a Dot graph.
* *

View File

@@ -20,9 +20,9 @@
#ifndef IELR_H_ #ifndef IELR_H_
# define IELR_H_ # define IELR_H_
#include <bitset.h> # include <bitset.h>
#include "state.h" # include "state.h"
/** /**
* \pre * \pre

View File

@@ -88,9 +88,9 @@ typedef struct
} location; } location;
#define GRAM_LTYPE location # define GRAM_LTYPE location
#define EMPTY_LOCATION_INIT {{NULL, 0, 0}, {NULL, 0, 0}} # define EMPTY_LOCATION_INIT {{NULL, 0, 0}, {NULL, 0, 0}}
extern location const empty_location; extern location const empty_location;
/* Set *LOC and adjust scanner cursor to account for token TOKEN of /* Set *LOC and adjust scanner cursor to account for token TOKEN of

View File

@@ -34,36 +34,36 @@ void muscle_free (void);
/* An obstack dedicated to receive muscle keys and values. */ /* An obstack dedicated to receive muscle keys and values. */
extern struct obstack muscle_obstack; extern struct obstack muscle_obstack;
#define MUSCLE_INSERT_BOOL(Key, Value) \ # define MUSCLE_INSERT_BOOL(Key, Value) \
do { \ do { \
int v__ = Value; \ int v__ = Value; \
MUSCLE_INSERT_INT (Key, v__); \ MUSCLE_INSERT_INT (Key, v__); \
} while (0) } while (0)
#define MUSCLE_INSERTF(Key, Format, Value) \ # define MUSCLE_INSERTF(Key, Format, Value) \
do { \ do { \
obstack_printf (&muscle_obstack, Format, Value); \ obstack_printf (&muscle_obstack, Format, Value); \
muscle_insert (Key, obstack_finish0 (&muscle_obstack)); \ muscle_insert (Key, obstack_finish0 (&muscle_obstack)); \
} while (0) } while (0)
#define MUSCLE_INSERT_INT(Key, Value) \ # define MUSCLE_INSERT_INT(Key, Value) \
MUSCLE_INSERTF(Key, "%d", Value) MUSCLE_INSERTF(Key, "%d", Value)
#define MUSCLE_INSERT_LONG_INT(Key, Value) \ # define MUSCLE_INSERT_LONG_INT(Key, Value) \
MUSCLE_INSERTF(Key, "%ld", Value) MUSCLE_INSERTF(Key, "%ld", Value)
/* Key -> Value, but don't apply escaping to Value. */ /* Key -> Value, but don't apply escaping to Value. */
#define MUSCLE_INSERT_STRING_RAW(Key, Value) \ # define MUSCLE_INSERT_STRING_RAW(Key, Value) \
MUSCLE_INSERTF(Key, "%s", Value) MUSCLE_INSERTF(Key, "%s", Value)
/* Key -> Value, applying M4 escaping to Value. */ /* Key -> Value, applying M4 escaping to Value. */
#define MUSCLE_INSERT_STRING(Key, Value) \ # define MUSCLE_INSERT_STRING(Key, Value) \
do { \ do { \
obstack_escape (&muscle_obstack, Value); \ obstack_escape (&muscle_obstack, Value); \
muscle_insert (Key, obstack_finish0 (&muscle_obstack)); \ muscle_insert (Key, obstack_finish0 (&muscle_obstack)); \
} while (0) } while (0)
#define MUSCLE_INSERT_C_STRING(Key, Value) \ # define MUSCLE_INSERT_C_STRING(Key, Value) \
do { \ do { \
obstack_escape (&muscle_obstack, \ obstack_escape (&muscle_obstack, \
quotearg_style (c_quoting_style, Value)); \ quotearg_style (c_quoting_style, Value)); \

View File

@@ -20,8 +20,8 @@
#ifndef NAMED_REF_H_ #ifndef NAMED_REF_H_
# define NAMED_REF_H_ # define NAMED_REF_H_
#include "location.h" # include "location.h"
#include "uniqstr.h" # include "uniqstr.h"
/* Named reference object. Keeps information about /* Named reference object. Keeps information about
a symbolic name of a symbol in a rule. */ a symbolic name of a symbol in a rule. */

View File

@@ -26,7 +26,7 @@
If GRAPH is a relation, then GRAPH[Node] is a list of adjacent If GRAPH is a relation, then GRAPH[Node] is a list of adjacent
nodes, ended with END_NODE. */ nodes, ended with END_NODE. */
#define END_NODE ((relation_node) -1) # define END_NODE ((relation_node) -1)
typedef size_t relation_node; typedef size_t relation_node;
typedef relation_node *relation_nodes; typedef relation_node *relation_nodes;

View File

@@ -93,7 +93,7 @@ typedef struct code_props {
void code_props_none_init (code_props *self); void code_props_none_init (code_props *self);
/** Equivalent to \c code_props_none_init. */ /** Equivalent to \c code_props_none_init. */
#define CODE_PROPS_NONE_INIT \ # define CODE_PROPS_NONE_INIT \
{ \ { \
/* .kind = */ CODE_PROPS_NONE, \ /* .kind = */ CODE_PROPS_NONE, \
/* .code = */ NULL, \ /* .code = */ NULL, \

View File

@@ -119,36 +119,36 @@ typedef struct
TRANSITIONS->states[Num]? Can be a token (amongst which the error TRANSITIONS->states[Num]? Can be a token (amongst which the error
token), or non terminals in case of gotos. */ token), or non terminals in case of gotos. */
#define TRANSITION_SYMBOL(Transitions, Num) \ # define TRANSITION_SYMBOL(Transitions, Num) \
(Transitions->states[Num]->accessing_symbol) (Transitions->states[Num]->accessing_symbol)
/* Is the TRANSITIONS->states[Num] a shift? (as opposed to gotos). */ /* Is the TRANSITIONS->states[Num] a shift? (as opposed to gotos). */
#define TRANSITION_IS_SHIFT(Transitions, Num) \ # define TRANSITION_IS_SHIFT(Transitions, Num) \
(ISTOKEN (TRANSITION_SYMBOL (Transitions, Num))) (ISTOKEN (TRANSITION_SYMBOL (Transitions, Num)))
/* Is the TRANSITIONS->states[Num] a goto?. */ /* Is the TRANSITIONS->states[Num] a goto?. */
#define TRANSITION_IS_GOTO(Transitions, Num) \ # define TRANSITION_IS_GOTO(Transitions, Num) \
(!TRANSITION_IS_SHIFT (Transitions, Num)) (!TRANSITION_IS_SHIFT (Transitions, Num))
/* Is the TRANSITIONS->states[Num] labelled by the error token? */ /* Is the TRANSITIONS->states[Num] labelled by the error token? */
#define TRANSITION_IS_ERROR(Transitions, Num) \ # define TRANSITION_IS_ERROR(Transitions, Num) \
(TRANSITION_SYMBOL (Transitions, Num) == errtoken->number) (TRANSITION_SYMBOL (Transitions, Num) == errtoken->number)
/* When resolving a SR conflicts, if the reduction wins, the shift is /* When resolving a SR conflicts, if the reduction wins, the shift is
disabled. */ disabled. */
#define TRANSITION_DISABLE(Transitions, Num) \ # define TRANSITION_DISABLE(Transitions, Num) \
(Transitions->states[Num] = NULL) (Transitions->states[Num] = NULL)
#define TRANSITION_IS_DISABLED(Transitions, Num) \ # define TRANSITION_IS_DISABLED(Transitions, Num) \
(Transitions->states[Num] == NULL) (Transitions->states[Num] == NULL)
/* Iterate over each transition over a token (shifts). */ /* Iterate over each transition over a token (shifts). */
#define FOR_EACH_SHIFT(Transitions, Iter) \ # define FOR_EACH_SHIFT(Transitions, Iter) \
for (Iter = 0; \ for (Iter = 0; \
Iter < Transitions->num \ Iter < Transitions->num \
&& (TRANSITION_IS_DISABLED (Transitions, Iter) \ && (TRANSITION_IS_DISABLED (Transitions, Iter) \

View File

@@ -46,7 +46,7 @@ typedef enum
/** Internal token numbers. */ /** Internal token numbers. */
typedef int symbol_number; typedef int symbol_number;
#define SYMBOL_NUMBER_MAXIMUM INT_MAX # define SYMBOL_NUMBER_MAXIMUM INT_MAX
typedef struct symbol symbol; typedef struct symbol symbol;
@@ -126,16 +126,16 @@ struct symbol
}; };
/** Undefined user number. */ /** Undefined user number. */
#define USER_NUMBER_UNDEFINED -1 # define USER_NUMBER_UNDEFINED -1
/* `symbol->user_token_number == USER_NUMBER_HAS_STRING_ALIAS' means /* `symbol->user_token_number == USER_NUMBER_HAS_STRING_ALIAS' means
this symbol has a literal string alias. For instance, `%token foo this symbol has a literal string alias. For instance, `%token foo
"foo"' has `"foo"' numbered regularly, and `foo' numbered as "foo"' has `"foo"' numbered regularly, and `foo' numbered as
USER_NUMBER_HAS_STRING_ALIAS. */ USER_NUMBER_HAS_STRING_ALIAS. */
#define USER_NUMBER_HAS_STRING_ALIAS -9991 # define USER_NUMBER_HAS_STRING_ALIAS -9991
/* Undefined internal token number. */ /* Undefined internal token number. */
#define NUMBER_UNDEFINED (-1) # define NUMBER_UNDEFINED (-1)
/** Fetch (or create) the symbol associated to KEY. */ /** Fetch (or create) the symbol associated to KEY. */
symbol *symbol_from_uniqstr (const uniqstr key, location loc); symbol *symbol_from_uniqstr (const uniqstr key, location loc);

View File

@@ -16,61 +16,61 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef BISON_SYSTEM_H #ifndef BISON_SYSTEM_H
#define BISON_SYSTEM_H # define BISON_SYSTEM_H
/* flex 2.5.31 gratutiously defines macros like INT8_MIN. But this /* flex 2.5.31 gratutiously defines macros like INT8_MIN. But this
runs afoul of pre-C99 compilers that have <inttypes.h> or runs afoul of pre-C99 compilers that have <inttypes.h> or
<stdint.h>, which are included below if available. It also runs <stdint.h>, which are included below if available. It also runs
afoul of pre-C99 compilers that define these macros in <limits.h>. */ afoul of pre-C99 compilers that define these macros in <limits.h>. */
#if ! defined __STDC_VERSION__ || __STDC_VERSION__ < 199901 # if ! defined __STDC_VERSION__ || __STDC_VERSION__ < 199901
# undef INT8_MIN # undef INT8_MIN
# undef INT16_MIN # undef INT16_MIN
# undef INT32_MIN # undef INT32_MIN
# undef INT8_MAX # undef INT8_MAX
# undef INT16_MAX # undef INT16_MAX
# undef UINT8_MAX # undef UINT8_MAX
# undef INT32_MAX # undef INT32_MAX
# undef UINT16_MAX # undef UINT16_MAX
# undef UINT32_MAX # undef UINT32_MAX
#endif # endif
#include <limits.h> # include <limits.h>
#include <stddef.h> # include <stddef.h>
#include <stdlib.h> # include <stdlib.h>
#include <string.h> # include <string.h>
#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array)) # define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
#define STREQ(L, R) (strcmp(L, R) == 0) # define STREQ(L, R) (strcmp(L, R) == 0)
#define STRNEQ(L, R) (!STREQ(L, R)) # define STRNEQ(L, R) (!STREQ(L, R))
/* Just like strncmp, but the second argument must be a literal string /* Just like strncmp, but the second argument must be a literal string
and you don't specify the length. */ and you don't specify the length. */
#define STRNCMP_LIT(S, Literal) \ # define STRNCMP_LIT(S, Literal) \
strncmp (S, "" Literal "", sizeof (Literal) - 1) strncmp (S, "" Literal "", sizeof (Literal) - 1)
/* Whether Literal is a prefix of S. */ /* Whether Literal is a prefix of S. */
#define STRPREFIX_LIT(Literal, S) \ # define STRPREFIX_LIT(Literal, S) \
(STRNCMP_LIT (S, Literal) == 0) (STRNCMP_LIT (S, Literal) == 0)
#include <unistd.h> # include <unistd.h>
#include <inttypes.h> # include <inttypes.h>
#ifndef UINTPTR_MAX # ifndef UINTPTR_MAX
/* This isn't perfect, but it's good enough for Bison, which needs /* This isn't perfect, but it's good enough for Bison, which needs
only to hash pointers. */ only to hash pointers. */
typedef size_t uintptr_t; typedef size_t uintptr_t;
#endif # endif
/* Version mismatch. */ /* Version mismatch. */
#define EX_MISMATCH 63 # define EX_MISMATCH 63
/*---------. /*---------.
| Gnulib. | | Gnulib. |
`---------*/ `---------*/
#include <unlocked-io.h> # include <unlocked-io.h>
#include <verify.h> # include <verify.h>
#include <xalloc.h> # include <xalloc.h>
/*-----------------. /*-----------------.
@@ -89,48 +89,48 @@ typedef size_t uintptr_t;
and safer logic than it would for users. Due to the overhead of M4, and safer logic than it would for users. Due to the overhead of M4,
suppressing Code is unlikely to offer any significant improvement in suppressing Code is unlikely to offer any significant improvement in
Bison's performance anyway. */ Bison's performance anyway. */
#define PACIFY_CC(Code) Code # define PACIFY_CC(Code) Code
#ifndef __attribute__ # ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */ /* This feature is available in gcc versions 2.5 and later. */
# if (! defined __GNUC__ || __GNUC__ < 2 \ # if (! defined __GNUC__ || __GNUC__ < 2 \
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
# define __attribute__(Spec) /* empty */ # define __attribute__(Spec) /* empty */
# endif
# endif # endif
#endif
/* The __-protected variants of `format' and `printf' attributes /* The __-protected variants of `format' and `printf' attributes
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __format__ format # define __format__ format
# define __printf__ printf # define __printf__ printf
#endif # endif
#ifndef ATTRIBUTE_NORETURN # ifndef ATTRIBUTE_NORETURN
# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) # define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
#endif # endif
#ifndef ATTRIBUTE_UNUSED # ifndef ATTRIBUTE_UNUSED
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) # define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
#endif # endif
/*------. /*------.
| NLS. | | NLS. |
`------*/ `------*/
#include <locale.h> # include <locale.h>
#include <gettext.h> # include <gettext.h>
#define _(Msgid) gettext (Msgid) # define _(Msgid) gettext (Msgid)
#define N_(Msgid) (Msgid) # define N_(Msgid) (Msgid)
/*-----------. /*-----------.
| Booleans. | | Booleans. |
`-----------*/ `-----------*/
#include <stdbool.h> # include <stdbool.h>
@@ -156,21 +156,21 @@ typedef size_t uintptr_t;
For now, we use assert but we call it aver throughout Bison in case For now, we use assert but we call it aver throughout Bison in case
we later wish to try another scheme. we later wish to try another scheme.
*/ */
#include <assert.h> # include <assert.h>
#define aver assert # define aver assert
/*-----------. /*-----------.
| Obstacks. | | Obstacks. |
`-----------*/ `-----------*/
#define obstack_chunk_alloc xmalloc # define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free # define obstack_chunk_free free
#include <obstack.h> # include <obstack.h>
/* String-grow: append Str to Obs. */ /* String-grow: append Str to Obs. */
#define obstack_sgrow(Obs, Str) \ # define obstack_sgrow(Obs, Str) \
obstack_grow (Obs, Str, strlen (Str)) obstack_grow (Obs, Str, strlen (Str))
/* Output Str escaped for our postprocessing (i.e., escape M4 special /* Output Str escaped for our postprocessing (i.e., escape M4 special
@@ -216,7 +216,7 @@ typedef size_t uintptr_t;
/* Append the ending 0, finish Obs, and return the string. */ /* Append the ending 0, finish Obs, and return the string. */
# define obstack_finish0(Obs) \ # define obstack_finish0(Obs) \
(obstack_1grow (Obs, '\0'), (char *) obstack_finish (Obs)) (obstack_1grow (Obs, '\0'), (char *) obstack_finish (Obs))
@@ -224,13 +224,13 @@ typedef size_t uintptr_t;
| Extensions to use for the output files. | | Extensions to use for the output files. |
`-----------------------------------------*/ `-----------------------------------------*/
#ifndef OUTPUT_EXT # ifndef OUTPUT_EXT
# define OUTPUT_EXT ".output" # define OUTPUT_EXT ".output"
#endif # endif
#ifndef TAB_EXT # ifndef TAB_EXT
# define TAB_EXT ".tab" # define TAB_EXT ".tab"
#endif # endif
@@ -238,15 +238,15 @@ typedef size_t uintptr_t;
| Free a linked list. | | Free a linked list. |
`---------------------*/ `---------------------*/
#define LIST_FREE(Type, List) \ # define LIST_FREE(Type, List) \
do { \ do { \
Type *_node, *_next; \ Type *_node, *_next; \
for (_node = List; _node; _node = _next) \ for (_node = List; _node; _node = _next) \
{ \ { \
_next = _node->next; \ _next = _node->next; \
free (_node); \ free (_node); \
} \ } \
} while (0) } while (0)
/*---------------------------------------------. /*---------------------------------------------.

View File

@@ -36,11 +36,11 @@ uniqstr uniqstr_vsprintf (char const *format, ...)
__attribute__ ((__format__ (__printf__, 1, 2))); __attribute__ ((__format__ (__printf__, 1, 2)));
/* Two uniqstr values have the same value iff they are the same. */ /* Two uniqstr values have the same value iff they are the same. */
#define UNIQSTR_EQ(USTR1, USTR2) (!!((USTR1) == (USTR2))) # define UNIQSTR_EQ(USTR1, USTR2) (!!((USTR1) == (USTR2)))
/* Compare two uniqstr a la strcmp: negative for <, nul for =, and /* Compare two uniqstr a la strcmp: negative for <, nul for =, and
positive for >. Undefined order, relies on addresses. */ positive for >. Undefined order, relies on addresses. */
#define UNIQSTR_CMP(USTR1, USTR2) ((USTR1) - (USTR2)) # define UNIQSTR_CMP(USTR1, USTR2) ((USTR1) - (USTR2))
/*--------------------------------------. /*--------------------------------------.
| Initializing, destroying, debugging. | | Initializing, destroying, debugging. |
@@ -69,30 +69,30 @@ void uniqstrs_print (void);
checking. Unfortunately, because of the missing format string in the checking. Unfortunately, because of the missing format string in the
macro invocation, the argument number reported by gcc for a bad macro invocation, the argument number reported by gcc for a bad
argument type is 1 too large. */ argument type is 1 too large. */
#define UNIQSTR_CONCAT(...) \ # define UNIQSTR_CONCAT(...) \
uniqstr_vsprintf (UNIQSTR_GEN_FORMAT (__VA_ARGS__, \ uniqstr_vsprintf (UNIQSTR_GEN_FORMAT (__VA_ARGS__, \
"%s", "%s", "%s", "%s", "%s", \ "%s", "%s", "%s", "%s", "%s", \
"%s", "%s", "%s", "%s", "%s", \ "%s", "%s", "%s", "%s", "%s", \
"%s", "%s", "%s", "%s", "%s", \ "%s", "%s", "%s", "%s", "%s", \
"%s", "%s", "%s", "%s", "%s"), \ "%s", "%s", "%s", "%s", "%s"), \
__VA_ARGS__) __VA_ARGS__)
#define UNIQSTR_GEN_FORMAT(F1, F2, F3, F4, F5, \ # define UNIQSTR_GEN_FORMAT(F1, F2, F3, F4, F5, \
F6, F7, F8, F9, F10, \ F6, F7, F8, F9, F10, \
F11, F12, F13, F14, F15, \ F11, F12, F13, F14, F15, \
F16, F17, F18, F19, F20, \ F16, F17, F18, F19, F20, \
...) \ ...) \
UNIQSTR_GEN_FORMAT_ (__VA_ARGS__, \ UNIQSTR_GEN_FORMAT_ (__VA_ARGS__, \
"", "", "", "", "", \ "", "", "", "", "", \
"", "", "", "", "", \ "", "", "", "", "", \
"", "", "", "", "", \ "", "", "", "", "", \
"", "", "", "", "") "", "", "", "", "")
#define UNIQSTR_GEN_FORMAT_(F1, F2, F3, F4, F5, \ # define UNIQSTR_GEN_FORMAT_(F1, F2, F3, F4, F5, \
F6, F7, F8, F9, F10, \ F6, F7, F8, F9, F10, \
F11, F12, F13, F14, F15, \ F11, F12, F13, F14, F15, \
F16, F17, F18, F19, F20, ...) \ F16, F17, F18, F19, F20, ...) \
F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 \ F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 \
F11 F12 F13 F14 F15 F16 F17 F18 F19 F20 F11 F12 F13 F14 F15 F16 F17 F18 F19 F20
#endif /* ! defined UNIQSTR_H_ */ #endif /* ! defined UNIQSTR_H_ */