mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
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:
@@ -20,10 +20,10 @@
|
||||
#ifndef ANNOTATION_LIST_H_
|
||||
# define ANNOTATION_LIST_H_
|
||||
|
||||
#include <bitsetv.h>
|
||||
#include "Sbitset.h"
|
||||
#include "InadequacyList.h"
|
||||
#include "state.h"
|
||||
# include <bitsetv.h>
|
||||
# include "Sbitset.h"
|
||||
# include "InadequacyList.h"
|
||||
# include "state.h"
|
||||
|
||||
typedef unsigned int AnnotationIndex;
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
#ifndef INADEQUACY_LIST_H_
|
||||
# define INADEQUACY_LIST_H_
|
||||
|
||||
#include <bitset.h>
|
||||
#include "gram.h"
|
||||
#include "state.h"
|
||||
#include "symtab.h"
|
||||
# include <bitset.h>
|
||||
# include "gram.h"
|
||||
# include "state.h"
|
||||
# include "symtab.h"
|
||||
|
||||
/**
|
||||
* A unique ID assigned to every \c InadequacyList node.
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
|
||||
typedef unsigned char *Sbitset;
|
||||
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)
|
||||
#define Sbitset__byteAddress(SELF, INDEX) \
|
||||
# define Sbitset__byteAddress(SELF, INDEX) \
|
||||
(((SELF) + (INDEX) / CHAR_BIT))
|
||||
#define Sbitset__bit_mask(INDEX) \
|
||||
# define Sbitset__bit_mask(INDEX) \
|
||||
(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))
|
||||
|
||||
/* nbits must not be 0. */
|
||||
@@ -39,54 +39,54 @@ Sbitset Sbitset__new_on_obstack (Sbitset__Index nbits,
|
||||
struct obstack *obstackp);
|
||||
void Sbitset__delete (Sbitset self);
|
||||
|
||||
#define Sbitset__test(SELF, INDEX) \
|
||||
# define Sbitset__test(SELF, INDEX) \
|
||||
((*Sbitset__byteAddress ((SELF), (INDEX)) & Sbitset__bit_mask (INDEX)) != 0)
|
||||
|
||||
bool Sbitset__isEmpty (Sbitset self, Sbitset__Index nbits);
|
||||
|
||||
void Sbitset__fprint(Sbitset self, Sbitset__Index nbits, FILE *file);
|
||||
|
||||
#define Sbitset__set(SELF, INDEX) \
|
||||
do { \
|
||||
*Sbitset__byteAddress ((SELF), (INDEX)) = \
|
||||
*Sbitset__byteAddress ((SELF), (INDEX)) | Sbitset__bit_mask (INDEX); \
|
||||
} while(0)
|
||||
# define Sbitset__set(SELF, INDEX) \
|
||||
do { \
|
||||
*Sbitset__byteAddress ((SELF), (INDEX)) = \
|
||||
*Sbitset__byteAddress ((SELF), (INDEX)) | Sbitset__bit_mask (INDEX); \
|
||||
} while(0)
|
||||
|
||||
#define Sbitset__reset(SELF, INDEX) \
|
||||
do { \
|
||||
*Sbitset__byteAddress ((SELF), (INDEX)) = \
|
||||
*Sbitset__byteAddress ((SELF), (INDEX)) & ~Sbitset__bit_mask (INDEX); \
|
||||
} while(0)
|
||||
# define Sbitset__reset(SELF, INDEX) \
|
||||
do { \
|
||||
*Sbitset__byteAddress ((SELF), (INDEX)) = \
|
||||
*Sbitset__byteAddress ((SELF), (INDEX)) & ~Sbitset__bit_mask (INDEX); \
|
||||
} while(0)
|
||||
|
||||
/* NBITS is the size of the bitset. More than NBITS bits might be reset. */
|
||||
#define Sbitset__zero(SELF, NBITS) \
|
||||
do { \
|
||||
memset (SELF, 0, Sbitset__nbytes (NBITS)); \
|
||||
} while(0)
|
||||
# define Sbitset__zero(SELF, NBITS) \
|
||||
do { \
|
||||
memset (SELF, 0, Sbitset__nbytes (NBITS)); \
|
||||
} while(0)
|
||||
|
||||
/* NBITS is the size of the bitset. More than NBITS bits might be set. */
|
||||
#define Sbitset__ones(SELF, NBITS) \
|
||||
do { \
|
||||
memset (SELF, UCHAR_MAX, Sbitset__nbytes (NBITS)); \
|
||||
} while(0)
|
||||
# define Sbitset__ones(SELF, NBITS) \
|
||||
do { \
|
||||
memset (SELF, UCHAR_MAX, Sbitset__nbytes (NBITS)); \
|
||||
} while(0)
|
||||
|
||||
/* NBITS is the size of every bitset. More than NBITS bits might be set. */
|
||||
#define Sbitset__or(SELF, OTHER1, OTHER2, NBITS) \
|
||||
do { \
|
||||
Sbitset ptr_self = (SELF); \
|
||||
Sbitset ptr_other1 = (OTHER1); \
|
||||
Sbitset ptr_other2 = (OTHER2); \
|
||||
Sbitset end_self = ptr_self + Sbitset__nbytes (NBITS); \
|
||||
for (; ptr_self < end_self; ++ptr_self, ++ptr_other1, ++ptr_other2) \
|
||||
*ptr_self = *ptr_other1 | *ptr_other2; \
|
||||
} while(0)
|
||||
# define Sbitset__or(SELF, OTHER1, OTHER2, NBITS) \
|
||||
do { \
|
||||
Sbitset ptr_self = (SELF); \
|
||||
Sbitset ptr_other1 = (OTHER1); \
|
||||
Sbitset ptr_other2 = (OTHER2); \
|
||||
Sbitset end_self = ptr_self + Sbitset__nbytes (NBITS); \
|
||||
for (; ptr_self < end_self; ++ptr_self, ++ptr_other1, ++ptr_other2) \
|
||||
*ptr_self = *ptr_other1 | *ptr_other2; \
|
||||
} while(0)
|
||||
|
||||
#define SBITSET__FOR_EACH(SELF, NBITS, ITER, INDEX) \
|
||||
for ((ITER) = (SELF); (ITER) < (SELF) + Sbitset__nbytes (NBITS); ++(ITER)) \
|
||||
if (*(ITER) != 0) \
|
||||
for ((INDEX) = ((ITER)-(SELF))*CHAR_BIT; \
|
||||
(INDEX) < (NBITS) && (SELF)+(INDEX)/CHAR_BIT < (ITER)+1; \
|
||||
++(INDEX)) \
|
||||
# define SBITSET__FOR_EACH(SELF, NBITS, ITER, INDEX) \
|
||||
for ((ITER) = (SELF); (ITER) < (SELF) + Sbitset__nbytes (NBITS); ++(ITER)) \
|
||||
if (*(ITER) != 0) \
|
||||
for ((INDEX) = ((ITER)-(SELF))*CHAR_BIT; \
|
||||
(INDEX) < (NBITS) && (SELF)+(INDEX)/CHAR_BIT < (ITER)+1; \
|
||||
++(INDEX)) \
|
||||
if (((*ITER) & Sbitset__bit_mask (INDEX)) != 0)
|
||||
|
||||
#endif /* !SBITSET_H_ */
|
||||
|
||||
@@ -44,7 +44,7 @@ static bitsetv firsts = NULL;
|
||||
|
||||
/* Retrieve the FDERIVES/FIRSTS sets of the nonterminals numbered Var. */
|
||||
#define FDERIVES(Var) fderives[(Var) - ntokens]
|
||||
#define FIRSTS(Var) firsts[(Var) - ntokens]
|
||||
#define FIRSTS(Var) firsts[(Var) - ntokens]
|
||||
|
||||
|
||||
/*-----------------.
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
# include "location.h"
|
||||
|
||||
/* Sub-messages indent. */
|
||||
#define SUB_INDENT (4)
|
||||
# define SUB_INDENT (4)
|
||||
|
||||
/*-------------.
|
||||
| --warnings. |
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
+ (YY_FLEX_SUBMINOR_VERSION))
|
||||
|
||||
/* 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);
|
||||
FILE *FLEX_PREFIX (get_in) (void);
|
||||
FILE *FLEX_PREFIX (get_out) (void);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef GETARGS_H_
|
||||
# define GETARGS_H_
|
||||
|
||||
#include "location.h"
|
||||
# include "location.h"
|
||||
|
||||
enum { command_line_prio, grammar_prio, default_prio };
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ extern int ntokens;
|
||||
extern int nvars;
|
||||
|
||||
typedef int item_number;
|
||||
#define ITEM_NUMBER_MAX INT_MAX
|
||||
# define ITEM_NUMBER_MAX INT_MAX
|
||||
extern item_number *ritem;
|
||||
extern unsigned int nritems;
|
||||
|
||||
@@ -145,7 +145,7 @@ item_number_is_symbol_number (item_number i)
|
||||
|
||||
/* Rule numbers. */
|
||||
typedef int rule_number;
|
||||
#define RULE_NUMBER_MAX INT_MAX
|
||||
# define RULE_NUMBER_MAX INT_MAX
|
||||
extern rule_number nrules;
|
||||
|
||||
static inline item_number
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#ifndef GRAPHVIZ_H_
|
||||
# define GRAPHVIZ_H_
|
||||
|
||||
#include "state.h"
|
||||
# include "state.h"
|
||||
|
||||
/** Begin a Dot graph.
|
||||
*
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
#ifndef IELR_H_
|
||||
# define IELR_H_
|
||||
|
||||
#include <bitset.h>
|
||||
# include <bitset.h>
|
||||
|
||||
#include "state.h"
|
||||
# include "state.h"
|
||||
|
||||
/**
|
||||
* \pre
|
||||
|
||||
@@ -88,9 +88,9 @@ typedef struct
|
||||
|
||||
} 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;
|
||||
|
||||
/* Set *LOC and adjust scanner cursor to account for token TOKEN of
|
||||
|
||||
@@ -34,36 +34,36 @@ 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__); \
|
||||
# define MUSCLE_INSERT_BOOL(Key, Value) \
|
||||
do { \
|
||||
int v__ = Value; \
|
||||
MUSCLE_INSERT_INT (Key, v__); \
|
||||
} while (0)
|
||||
|
||||
#define MUSCLE_INSERTF(Key, Format, Value) \
|
||||
# define MUSCLE_INSERTF(Key, Format, Value) \
|
||||
do { \
|
||||
obstack_printf (&muscle_obstack, Format, Value); \
|
||||
muscle_insert (Key, obstack_finish0 (&muscle_obstack)); \
|
||||
} while (0)
|
||||
|
||||
#define MUSCLE_INSERT_INT(Key, Value) \
|
||||
# define MUSCLE_INSERT_INT(Key, 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)
|
||||
|
||||
/* 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)
|
||||
|
||||
/* Key -> Value, applying M4 escaping to Value. */
|
||||
#define MUSCLE_INSERT_STRING(Key, Value) \
|
||||
# define MUSCLE_INSERT_STRING(Key, Value) \
|
||||
do { \
|
||||
obstack_escape (&muscle_obstack, Value); \
|
||||
muscle_insert (Key, obstack_finish0 (&muscle_obstack)); \
|
||||
} while (0)
|
||||
|
||||
#define MUSCLE_INSERT_C_STRING(Key, Value) \
|
||||
# define MUSCLE_INSERT_C_STRING(Key, Value) \
|
||||
do { \
|
||||
obstack_escape (&muscle_obstack, \
|
||||
quotearg_style (c_quoting_style, Value)); \
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
#ifndef NAMED_REF_H_
|
||||
# define NAMED_REF_H_
|
||||
|
||||
#include "location.h"
|
||||
#include "uniqstr.h"
|
||||
# include "location.h"
|
||||
# include "uniqstr.h"
|
||||
|
||||
/* Named reference object. Keeps information about
|
||||
a symbolic name of a symbol in a rule. */
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
If GRAPH is a relation, then GRAPH[Node] is a list of adjacent
|
||||
nodes, ended with END_NODE. */
|
||||
|
||||
#define END_NODE ((relation_node) -1)
|
||||
# define END_NODE ((relation_node) -1)
|
||||
|
||||
typedef size_t relation_node;
|
||||
typedef relation_node *relation_nodes;
|
||||
|
||||
@@ -93,7 +93,7 @@ typedef struct code_props {
|
||||
void code_props_none_init (code_props *self);
|
||||
|
||||
/** Equivalent to \c code_props_none_init. */
|
||||
#define CODE_PROPS_NONE_INIT \
|
||||
# define CODE_PROPS_NONE_INIT \
|
||||
{ \
|
||||
/* .kind = */ CODE_PROPS_NONE, \
|
||||
/* .code = */ NULL, \
|
||||
|
||||
14
src/state.h
14
src/state.h
@@ -119,36 +119,36 @@ typedef struct
|
||||
TRANSITIONS->states[Num]? Can be a token (amongst which the error
|
||||
token), or non terminals in case of gotos. */
|
||||
|
||||
#define TRANSITION_SYMBOL(Transitions, Num) \
|
||||
# define TRANSITION_SYMBOL(Transitions, Num) \
|
||||
(Transitions->states[Num]->accessing_symbol)
|
||||
|
||||
/* 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)))
|
||||
|
||||
/* Is the TRANSITIONS->states[Num] a goto?. */
|
||||
|
||||
#define TRANSITION_IS_GOTO(Transitions, Num) \
|
||||
# define TRANSITION_IS_GOTO(Transitions, Num) \
|
||||
(!TRANSITION_IS_SHIFT (Transitions, Num))
|
||||
|
||||
/* 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)
|
||||
|
||||
/* When resolving a SR conflicts, if the reduction wins, the shift is
|
||||
disabled. */
|
||||
|
||||
#define TRANSITION_DISABLE(Transitions, Num) \
|
||||
# define TRANSITION_DISABLE(Transitions, Num) \
|
||||
(Transitions->states[Num] = NULL)
|
||||
|
||||
#define TRANSITION_IS_DISABLED(Transitions, Num) \
|
||||
# define TRANSITION_IS_DISABLED(Transitions, Num) \
|
||||
(Transitions->states[Num] == NULL)
|
||||
|
||||
|
||||
/* Iterate over each transition over a token (shifts). */
|
||||
#define FOR_EACH_SHIFT(Transitions, Iter) \
|
||||
# define FOR_EACH_SHIFT(Transitions, Iter) \
|
||||
for (Iter = 0; \
|
||||
Iter < Transitions->num \
|
||||
&& (TRANSITION_IS_DISABLED (Transitions, Iter) \
|
||||
|
||||
@@ -46,7 +46,7 @@ typedef enum
|
||||
|
||||
/** Internal token numbers. */
|
||||
typedef int symbol_number;
|
||||
#define SYMBOL_NUMBER_MAXIMUM INT_MAX
|
||||
# define SYMBOL_NUMBER_MAXIMUM INT_MAX
|
||||
|
||||
|
||||
typedef struct symbol symbol;
|
||||
@@ -126,16 +126,16 @@ struct symbol
|
||||
};
|
||||
|
||||
/** Undefined user number. */
|
||||
#define USER_NUMBER_UNDEFINED -1
|
||||
# define USER_NUMBER_UNDEFINED -1
|
||||
|
||||
/* `symbol->user_token_number == USER_NUMBER_HAS_STRING_ALIAS' means
|
||||
this symbol has a literal string alias. For instance, `%token foo
|
||||
"foo"' has `"foo"' numbered regularly, and `foo' numbered as
|
||||
USER_NUMBER_HAS_STRING_ALIAS. */
|
||||
#define USER_NUMBER_HAS_STRING_ALIAS -9991
|
||||
# define USER_NUMBER_HAS_STRING_ALIAS -9991
|
||||
|
||||
/* Undefined internal token number. */
|
||||
#define NUMBER_UNDEFINED (-1)
|
||||
# define NUMBER_UNDEFINED (-1)
|
||||
|
||||
/** Fetch (or create) the symbol associated to KEY. */
|
||||
symbol *symbol_from_uniqstr (const uniqstr key, location loc);
|
||||
|
||||
142
src/system.h
142
src/system.h
@@ -16,61 +16,61 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef BISON_SYSTEM_H
|
||||
#define BISON_SYSTEM_H
|
||||
# define BISON_SYSTEM_H
|
||||
|
||||
/* flex 2.5.31 gratutiously defines macros like INT8_MIN. But this
|
||||
runs afoul of pre-C99 compilers that have <inttypes.h> or
|
||||
<stdint.h>, which are included below if available. It also runs
|
||||
afoul of pre-C99 compilers that define these macros in <limits.h>. */
|
||||
#if ! defined __STDC_VERSION__ || __STDC_VERSION__ < 199901
|
||||
# undef INT8_MIN
|
||||
# undef INT16_MIN
|
||||
# undef INT32_MIN
|
||||
# undef INT8_MAX
|
||||
# undef INT16_MAX
|
||||
# undef UINT8_MAX
|
||||
# undef INT32_MAX
|
||||
# undef UINT16_MAX
|
||||
# undef UINT32_MAX
|
||||
#endif
|
||||
# if ! defined __STDC_VERSION__ || __STDC_VERSION__ < 199901
|
||||
# undef INT8_MIN
|
||||
# undef INT16_MIN
|
||||
# undef INT32_MIN
|
||||
# undef INT8_MAX
|
||||
# undef INT16_MAX
|
||||
# undef UINT8_MAX
|
||||
# undef INT32_MAX
|
||||
# undef UINT16_MAX
|
||||
# undef UINT32_MAX
|
||||
# endif
|
||||
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
# include <limits.h>
|
||||
# include <stddef.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
|
||||
#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
|
||||
#define STREQ(L, R) (strcmp(L, R) == 0)
|
||||
#define STRNEQ(L, R) (!STREQ(L, R))
|
||||
# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
|
||||
# define STREQ(L, R) (strcmp(L, R) == 0)
|
||||
# define STRNEQ(L, R) (!STREQ(L, R))
|
||||
|
||||
/* Just like strncmp, but the second argument must be a literal string
|
||||
and you don't specify the length. */
|
||||
#define STRNCMP_LIT(S, Literal) \
|
||||
# define STRNCMP_LIT(S, Literal) \
|
||||
strncmp (S, "" Literal "", sizeof (Literal) - 1)
|
||||
|
||||
/* Whether Literal is a prefix of S. */
|
||||
#define STRPREFIX_LIT(Literal, S) \
|
||||
# define STRPREFIX_LIT(Literal, S) \
|
||||
(STRNCMP_LIT (S, Literal) == 0)
|
||||
|
||||
#include <unistd.h>
|
||||
#include <inttypes.h>
|
||||
# include <unistd.h>
|
||||
# include <inttypes.h>
|
||||
|
||||
#ifndef UINTPTR_MAX
|
||||
# ifndef UINTPTR_MAX
|
||||
/* This isn't perfect, but it's good enough for Bison, which needs
|
||||
only to hash pointers. */
|
||||
typedef size_t uintptr_t;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/* Version mismatch. */
|
||||
#define EX_MISMATCH 63
|
||||
# define EX_MISMATCH 63
|
||||
|
||||
/*---------.
|
||||
| Gnulib. |
|
||||
`---------*/
|
||||
|
||||
#include <unlocked-io.h>
|
||||
#include <verify.h>
|
||||
#include <xalloc.h>
|
||||
# include <unlocked-io.h>
|
||||
# include <verify.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,
|
||||
suppressing Code is unlikely to offer any significant improvement in
|
||||
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. */
|
||||
# if (! defined __GNUC__ || __GNUC__ < 2 \
|
||||
# if (! defined __GNUC__ || __GNUC__ < 2 \
|
||||
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
|
||||
# define __attribute__(Spec) /* empty */
|
||||
# define __attribute__(Spec) /* empty */
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The __-protected variants of `format' and `printf' attributes
|
||||
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
|
||||
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
|
||||
# define __format__ format
|
||||
# define __printf__ printf
|
||||
#endif
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
|
||||
# define __format__ format
|
||||
# define __printf__ printf
|
||||
# endif
|
||||
|
||||
#ifndef ATTRIBUTE_NORETURN
|
||||
# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
|
||||
#endif
|
||||
# ifndef ATTRIBUTE_NORETURN
|
||||
# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
|
||||
# endif
|
||||
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
||||
#endif
|
||||
# ifndef ATTRIBUTE_UNUSED
|
||||
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
||||
# endif
|
||||
|
||||
|
||||
/*------.
|
||||
| NLS. |
|
||||
`------*/
|
||||
|
||||
#include <locale.h>
|
||||
# include <locale.h>
|
||||
|
||||
#include <gettext.h>
|
||||
#define _(Msgid) gettext (Msgid)
|
||||
#define N_(Msgid) (Msgid)
|
||||
# include <gettext.h>
|
||||
# define _(Msgid) gettext (Msgid)
|
||||
# define N_(Msgid) (Msgid)
|
||||
|
||||
|
||||
/*-----------.
|
||||
| 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
|
||||
we later wish to try another scheme.
|
||||
*/
|
||||
#include <assert.h>
|
||||
#define aver assert
|
||||
# include <assert.h>
|
||||
# define aver assert
|
||||
|
||||
|
||||
/*-----------.
|
||||
| Obstacks. |
|
||||
`-----------*/
|
||||
|
||||
#define obstack_chunk_alloc xmalloc
|
||||
#define obstack_chunk_free free
|
||||
#include <obstack.h>
|
||||
# define obstack_chunk_alloc xmalloc
|
||||
# define obstack_chunk_free free
|
||||
# include <obstack.h>
|
||||
|
||||
/* String-grow: append Str to Obs. */
|
||||
|
||||
#define obstack_sgrow(Obs, Str) \
|
||||
# define obstack_sgrow(Obs, Str) \
|
||||
obstack_grow (Obs, Str, strlen (Str))
|
||||
|
||||
/* 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. */
|
||||
|
||||
# define obstack_finish0(Obs) \
|
||||
# define obstack_finish0(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. |
|
||||
`-----------------------------------------*/
|
||||
|
||||
#ifndef OUTPUT_EXT
|
||||
# define OUTPUT_EXT ".output"
|
||||
#endif
|
||||
# ifndef OUTPUT_EXT
|
||||
# define OUTPUT_EXT ".output"
|
||||
# endif
|
||||
|
||||
#ifndef TAB_EXT
|
||||
# define TAB_EXT ".tab"
|
||||
#endif
|
||||
# ifndef TAB_EXT
|
||||
# define TAB_EXT ".tab"
|
||||
# endif
|
||||
|
||||
|
||||
|
||||
@@ -238,15 +238,15 @@ typedef size_t uintptr_t;
|
||||
| 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)
|
||||
|
||||
|
||||
/*---------------------------------------------.
|
||||
|
||||
@@ -36,11 +36,11 @@ uniqstr uniqstr_vsprintf (char const *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 1, 2)));
|
||||
|
||||
/* 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
|
||||
positive for >. Undefined order, relies on addresses. */
|
||||
#define UNIQSTR_CMP(USTR1, USTR2) ((USTR1) - (USTR2))
|
||||
# define UNIQSTR_CMP(USTR1, USTR2) ((USTR1) - (USTR2))
|
||||
|
||||
/*--------------------------------------.
|
||||
| Initializing, destroying, debugging. |
|
||||
@@ -69,30 +69,30 @@ void uniqstrs_print (void);
|
||||
checking. Unfortunately, because of the missing format string in the
|
||||
macro invocation, the argument number reported by gcc for a bad
|
||||
argument type is 1 too large. */
|
||||
#define UNIQSTR_CONCAT(...) \
|
||||
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"), \
|
||||
# define UNIQSTR_CONCAT(...) \
|
||||
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"), \
|
||||
__VA_ARGS__)
|
||||
|
||||
#define UNIQSTR_GEN_FORMAT(F1, F2, F3, F4, F5, \
|
||||
F6, F7, F8, F9, F10, \
|
||||
F11, F12, F13, F14, F15, \
|
||||
F16, F17, F18, F19, F20, \
|
||||
...) \
|
||||
UNIQSTR_GEN_FORMAT_ (__VA_ARGS__, \
|
||||
"", "", "", "", "", \
|
||||
"", "", "", "", "", \
|
||||
"", "", "", "", "", \
|
||||
# define UNIQSTR_GEN_FORMAT(F1, F2, F3, F4, F5, \
|
||||
F6, F7, F8, F9, F10, \
|
||||
F11, F12, F13, F14, F15, \
|
||||
F16, F17, F18, F19, F20, \
|
||||
...) \
|
||||
UNIQSTR_GEN_FORMAT_ (__VA_ARGS__, \
|
||||
"", "", "", "", "", \
|
||||
"", "", "", "", "", \
|
||||
"", "", "", "", "", \
|
||||
"", "", "", "", "")
|
||||
|
||||
#define UNIQSTR_GEN_FORMAT_(F1, F2, F3, F4, F5, \
|
||||
F6, F7, F8, F9, F10, \
|
||||
F11, F12, F13, F14, F15, \
|
||||
F16, F17, F18, F19, F20, ...) \
|
||||
F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 \
|
||||
# define UNIQSTR_GEN_FORMAT_(F1, F2, F3, F4, F5, \
|
||||
F6, F7, F8, F9, F10, \
|
||||
F11, F12, F13, F14, F15, \
|
||||
F16, F17, F18, F19, F20, ...) \
|
||||
F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 \
|
||||
F11 F12 F13 F14 F15 F16 F17 F18 F19 F20
|
||||
|
||||
#endif /* ! defined UNIQSTR_H_ */
|
||||
|
||||
Reference in New Issue
Block a user