Commit 57c578a6 by Zack Weinberg Committed by Zack Weinberg

cpphash.h: #define __extension__ away if GCC_VERSION < 2095 (overly conservative).

	* cpphash.h: #define __extension__ away if GCC_VERSION < 2095
	(overly conservative).  Change extern inline wrappers to
	static inline, define them always, use PARAMS properly.
	* cpplex.c (_cpp_get_directive_token): Don't issue pedantic
	whitespace warnings for \f and \v at the beginning of a line.

From-SVN: r33674
parent 4e95db71
2000-05-04 Zack Weinberg <zack@wolery.cumb.org>
* cpphash.h: #define __extension__ away if GCC_VERSION < 2095
(overly conservative). Change extern inline wrappers to
static inline, define them always, use PARAMS properly.
* cpplex.c (_cpp_get_directive_token): Don't issue pedantic
whitespace warnings for \f and \v at the beginning of a line.
Thu May 4 10:03:50 2000 Jeffrey A Law (law@cygnus.com) Thu May 4 10:03:50 2000 Jeffrey A Law (law@cygnus.com)
* haifa-sched.c (schedule_insns): Free the flow edge list when it * haifa-sched.c (schedule_insns): Free the flow edge list when it
......
...@@ -25,6 +25,13 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ...@@ -25,6 +25,13 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
typedef unsigned char U_CHAR; typedef unsigned char U_CHAR;
#define U (const U_CHAR *) /* Intended use: U"string" */ #define U (const U_CHAR *) /* Intended use: U"string" */
/* gcc 2.7.2 can't handle __extension__ const char array[] = { ... }.
I don't know when this was added - be conservative, assume it only
works in 2.95. */
#if GCC_VERSION < 2095
#define __extension__
#endif
/* The structure of a node in the hash table. The hash table /* The structure of a node in the hash table. The hash table
has entries for all tokens defined by #define commands (type T_MACRO), has entries for all tokens defined by #define commands (type T_MACRO),
plus some special tokens like __LINE__ (these each have their own plus some special tokens like __LINE__ (these each have their own
...@@ -257,41 +264,51 @@ extern int _cpp_handle_directive PARAMS ((cpp_reader *)); ...@@ -257,41 +264,51 @@ extern int _cpp_handle_directive PARAMS ((cpp_reader *));
extern void _cpp_unwind_if_stack PARAMS ((cpp_reader *, cpp_buffer *)); extern void _cpp_unwind_if_stack PARAMS ((cpp_reader *, cpp_buffer *));
extern void _cpp_check_directive PARAMS ((cpp_toklist *, cpp_token *)); extern void _cpp_check_directive PARAMS ((cpp_toklist *, cpp_token *));
/* These are inline functions (if __GNUC__) instead of macros so we /* These are inline functions instead of macros so we can get type
can get type checking. */ checking. */
#if GCC_VERSION >= 2007 && defined __OPTIMIZE__
extern inline int ustrcmp (const U_CHAR *, const U_CHAR *);
extern inline int ustrncmp (const U_CHAR *, const U_CHAR *, size_t);
extern inline size_t ustrlen (const U_CHAR *);
extern inline U_CHAR *uxstrdup (const U_CHAR *);
extern inline U_CHAR *ustrchr (const U_CHAR *, int);
extern inline int static inline int ustrcmp PARAMS ((const U_CHAR *, const U_CHAR *));
ustrcmp (const U_CHAR *s1, const U_CHAR *s2) static inline int ustrncmp PARAMS ((const U_CHAR *, const U_CHAR *,
{ return strcmp ((const char *)s1, (const char *)s2); } size_t));
static inline size_t ustrlen PARAMS ((const U_CHAR *));
static inline U_CHAR *uxstrdup PARAMS ((const U_CHAR *));
static inline U_CHAR *ustrchr PARAMS ((const U_CHAR *, int));
extern inline int static inline int
ustrncmp (const U_CHAR *s1, const U_CHAR *s2, size_t n) ustrcmp (s1, s2)
{ return strncmp ((const char *)s1, (const char *)s2, n); } const U_CHAR *s1, *s2;
{
return strcmp ((const char *)s1, (const char *)s2);
}
extern inline size_t static inline int
ustrlen (const U_CHAR *s1) ustrncmp (s1, s2, n)
{ return strlen ((const char *)s1); } const U_CHAR *s1, *s2;
size_t n;
{
return strncmp ((const char *)s1, (const char *)s2, n);
}
extern inline U_CHAR * static inline size_t
uxstrdup (const U_CHAR *s1) ustrlen (s1)
{ return (U_CHAR *) xstrdup ((const char *)s1); } const U_CHAR *s1;
{
return strlen ((const char *)s1);
}
extern inline U_CHAR * static inline U_CHAR *
ustrchr (const U_CHAR *s1, int c) uxstrdup (s1)
{ return (U_CHAR *) strchr ((const char *)s1, c); } const U_CHAR *s1;
{
return (U_CHAR *) xstrdup ((const char *)s1);
}
#else static inline U_CHAR *
#define ustrcmp(s1_, s2_) strcmp((const char *)s1_, (const char *)s2_) ustrchr (s1, c)
#define ustrncmp(s1_, s2_, n_) strncmp((const char *)s1_, (const char *)s2_, n_) const U_CHAR *s1;
#define ustrlen(s1_) strlen((const char *)s1_) int c;
#define uxstrdup(s1_) (U_CHAR *) xstrdup((const char *)s1_) {
#define ustrchr(s1_, c_) (U_CHAR *) strchr((const char *)s1_, c_) return (U_CHAR *) strchr ((const char *)s1, c);
#endif }
#endif #endif
...@@ -1641,8 +1641,10 @@ _cpp_get_directive_token (pfile) ...@@ -1641,8 +1641,10 @@ _cpp_get_directive_token (pfile)
{ {
long old_written; long old_written;
enum cpp_ttype token; enum cpp_ttype token;
int at_bol;
get_next: get_next:
at_bol = (CPP_BUFFER (pfile)->cur == CPP_BUFFER (pfile)->line_base);
old_written = CPP_WRITTEN (pfile); old_written = CPP_WRITTEN (pfile);
token = _cpp_lex_token (pfile); token = _cpp_lex_token (pfile);
switch (token) switch (token)
...@@ -1657,7 +1659,9 @@ _cpp_get_directive_token (pfile) ...@@ -1657,7 +1659,9 @@ _cpp_get_directive_token (pfile)
return CPP_VSPACE; return CPP_VSPACE;
case CPP_HSPACE: case CPP_HSPACE:
if (CPP_PEDANTIC (pfile)) /* The purpose of this rather strange check is to prevent pedantic
warnings for ^L in an #ifdefed out block. */
if (CPP_PEDANTIC (pfile) && ! at_bol)
pedantic_whitespace (pfile, pfile->token_buffer + old_written, pedantic_whitespace (pfile, pfile->token_buffer + old_written,
CPP_WRITTEN (pfile) - old_written); CPP_WRITTEN (pfile) - old_written);
CPP_SET_WRITTEN (pfile, old_written); CPP_SET_WRITTEN (pfile, old_written);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment