X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/f518dbaf46eb28bd39695474de6118683d905e5f..22b081deb7ab1d0ec7a279e5213fa7fdc2c85207:/src/system.h diff --git a/src/system.h b/src/system.h index 7aa2c9fa..0d69e93e 100644 --- a/src/system.h +++ b/src/system.h @@ -42,6 +42,15 @@ #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) \ + strncmp (S, "" Literal "", sizeof (Literal) - 1) + +/* Whether Literal is a prefix of S. */ +#define STRPREFIX_LIT(Literal, S) \ + (STRNCMP_LIT (S, Literal) == 0) + #if HAVE_SYS_TYPES_H # include #endif @@ -88,7 +97,7 @@ typedef size_t uintptr_t; #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ # if (! defined __GNUC__ || __GNUC__ < 2 \ - || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__) + || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) # define __attribute__(Spec) /* empty */ # endif #endif