summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-04 16:21:29 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-04 16:21:29 +0000
commit88b05e081178d1e56362a58107a1449267564c60 (patch)
tree54a0badd8c16d499639fe79565ba47c91ae1a822
parentd6df780c4d82046ecfe40971c8d903ef31bc2711 (diff)
downloadgcc-88b05e081178d1e56362a58107a1449267564c60.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33674 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/cpphash.h77
-rw-r--r--gcc/cpplex.c6
3 files changed, 60 insertions, 31 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fa3465bbed9..0fcc6a56f31 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+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)
* haifa-sched.c (schedule_insns): Free the flow edge list when it
diff --git a/gcc/cpphash.h b/gcc/cpphash.h
index 3c9ae38ce6c..16de5bb1259 100644
--- a/gcc/cpphash.h
+++ b/gcc/cpphash.h
@@ -25,6 +25,13 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
typedef unsigned char U_CHAR;
#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
has entries for all tokens defined by #define commands (type T_MACRO),
plus some special tokens like __LINE__ (these each have their own
@@ -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_check_directive PARAMS ((cpp_toklist *, cpp_token *));
-/* These are inline functions (if __GNUC__) instead of macros so we
- can get type 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);
+/* These are inline functions instead of macros so we can get type
+ checking. */
-extern inline int
-ustrcmp (const U_CHAR *s1, const U_CHAR *s2)
-{ return strcmp ((const char *)s1, (const char *)s2); }
+static inline int ustrcmp PARAMS ((const U_CHAR *, const U_CHAR *));
+static inline int ustrncmp PARAMS ((const U_CHAR *, const U_CHAR *,
+ 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
-ustrncmp (const U_CHAR *s1, const U_CHAR *s2, size_t n)
-{ return strncmp ((const char *)s1, (const char *)s2, n); }
+static inline int
+ustrcmp (s1, s2)
+ const U_CHAR *s1, *s2;
+{
+ return strcmp ((const char *)s1, (const char *)s2);
+}
-extern inline size_t
-ustrlen (const U_CHAR *s1)
-{ return strlen ((const char *)s1); }
+static inline int
+ustrncmp (s1, s2, n)
+ const U_CHAR *s1, *s2;
+ size_t n;
+{
+ return strncmp ((const char *)s1, (const char *)s2, n);
+}
-extern inline U_CHAR *
-uxstrdup (const U_CHAR *s1)
-{ return (U_CHAR *) xstrdup ((const char *)s1); }
+static inline size_t
+ustrlen (s1)
+ const U_CHAR *s1;
+{
+ return strlen ((const char *)s1);
+}
-extern inline U_CHAR *
-ustrchr (const U_CHAR *s1, int c)
-{ return (U_CHAR *) strchr ((const char *)s1, c); }
+static inline U_CHAR *
+uxstrdup (s1)
+ const U_CHAR *s1;
+{
+ return (U_CHAR *) xstrdup ((const char *)s1);
+}
-#else
-#define ustrcmp(s1_, s2_) strcmp((const char *)s1_, (const char *)s2_)
-#define ustrncmp(s1_, s2_, n_) strncmp((const char *)s1_, (const char *)s2_, n_)
-#define ustrlen(s1_) strlen((const char *)s1_)
-#define uxstrdup(s1_) (U_CHAR *) xstrdup((const char *)s1_)
-#define ustrchr(s1_, c_) (U_CHAR *) strchr((const char *)s1_, c_)
-#endif
+static inline U_CHAR *
+ustrchr (s1, c)
+ const U_CHAR *s1;
+ int c;
+{
+ return (U_CHAR *) strchr ((const char *)s1, c);
+}
#endif
diff --git a/gcc/cpplex.c b/gcc/cpplex.c
index 9e068a3203d..78df852670d 100644
--- a/gcc/cpplex.c
+++ b/gcc/cpplex.c
@@ -1641,8 +1641,10 @@ _cpp_get_directive_token (pfile)
{
long old_written;
enum cpp_ttype token;
+ int at_bol;
get_next:
+ at_bol = (CPP_BUFFER (pfile)->cur == CPP_BUFFER (pfile)->line_base);
old_written = CPP_WRITTEN (pfile);
token = _cpp_lex_token (pfile);
switch (token)
@@ -1657,7 +1659,9 @@ _cpp_get_directive_token (pfile)
return CPP_VSPACE;
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,
CPP_WRITTEN (pfile) - old_written);
CPP_SET_WRITTEN (pfile, old_written);