From 0b67f687f8c1f2ba204c07ce2ab0f448b5427987 Mon Sep 17 00:00:00 2001
From: jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 13 Sep 2006 01:04:18 +0000
Subject: [PATCH] libcpp: 	PR c/28768 	PR preprocessor/14634 	*
 lex.c (lex_string): Pedwarn for unterminated literals.

libgomp:
	* configure.ac (HAVE_CLOCK_GETTIME): Add missing second argument
	to AC_DEFINE.
	* configure: Regenerate.

gcc/testsuite:
	* gcc.dg/cpp/include2.c, gcc.dg/cpp/macspace1.c,
	gcc.dg/cpp/macspace2.c, gcc.dg/cpp/multiline.c,
	gcc.dg/cpp/trad/literals-2.c: Update expected diagnostics.



git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116915 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/testsuite/ChangeLog                    |  8 +++
 gcc/testsuite/gcc.dg/cpp/include2.c        |  2 +-
 gcc/testsuite/gcc.dg/cpp/macspace1.c       |  2 +
 gcc/testsuite/gcc.dg/cpp/macspace2.c       |  2 +
 gcc/testsuite/gcc.dg/cpp/multiline.c       |  6 +-
 gcc/testsuite/gcc.dg/cpp/trad/literals-2.c |  2 +-
 libcpp/ChangeLog                           |  6 ++
 libcpp/lex.c                               |  4 ++
 libgomp/ChangeLog                          |  8 +++
 libgomp/configure                          | 73 ++++++++++++++++++----
 libgomp/configure.ac                       |  2 +-
 11 files changed, 99 insertions(+), 16 deletions(-)

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 81f7c7fbc55b..6169fddc6f16 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2006-09-13  Joseph S. Myers  <joseph@codesourcery.com>
+
+	PR c/28768
+	PR preprocessor/14634
+	* gcc.dg/cpp/include2.c, gcc.dg/cpp/macspace1.c,
+	gcc.dg/cpp/macspace2.c, gcc.dg/cpp/multiline.c,
+	gcc.dg/cpp/trad/literals-2.c: Update expected diagnostics.
+
 2006-09-12  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
 	* gcc.dg/pr28243.c: New test.
diff --git a/gcc/testsuite/gcc.dg/cpp/include2.c b/gcc/testsuite/gcc.dg/cpp/include2.c
index 60edfccb0cd6..46844bf2cc18 100644
--- a/gcc/testsuite/gcc.dg/cpp/include2.c
+++ b/gcc/testsuite/gcc.dg/cpp/include2.c
@@ -13,4 +13,4 @@
 /* These error is No such file or directory, just once.  However, this
    message is locale-dependent, so don't test for it.  */
 /* { dg-error "silly" "" { target *-*-* } 10 } */
-
+/* { dg-error "missing" "" { target *-*-* } 11 } */
diff --git a/gcc/testsuite/gcc.dg/cpp/macspace1.c b/gcc/testsuite/gcc.dg/cpp/macspace1.c
index ddd62c743b9a..daf14d2b1f13 100644
--- a/gcc/testsuite/gcc.dg/cpp/macspace1.c
+++ b/gcc/testsuite/gcc.dg/cpp/macspace1.c
@@ -59,3 +59,5 @@
 #define ag"abc"		/* { dg-warning "missing whitespace" } */
 
 int dummy;
+/* { dg-error "missing terminating" "" { target *-*-* } 6 } */
+/* { dg-error "missing terminating" "" { target *-*-* } 10 } */
diff --git a/gcc/testsuite/gcc.dg/cpp/macspace2.c b/gcc/testsuite/gcc.dg/cpp/macspace2.c
index 21576fa22fa4..7a81eceeac8b 100644
--- a/gcc/testsuite/gcc.dg/cpp/macspace2.c
+++ b/gcc/testsuite/gcc.dg/cpp/macspace2.c
@@ -59,3 +59,5 @@
 #define ag"abc"		/* { dg-error "requires whitespace" } */
 
 int dummy;
+/* { dg-error "missing terminating" "" { target *-*-* } 6 } */
+/* { dg-error "missing terminating" "" { target *-*-* } 10 } */
diff --git a/gcc/testsuite/gcc.dg/cpp/multiline.c b/gcc/testsuite/gcc.dg/cpp/multiline.c
index a71ebc69d88f..38798bdfaafa 100644
--- a/gcc/testsuite/gcc.dg/cpp/multiline.c
+++ b/gcc/testsuite/gcc.dg/cpp/multiline.c
@@ -19,5 +19,7 @@ L"line 1
 /* Nowhere in the output of this file should there be a blank line.
    We check for that in the .i file.
    { dg-final { scan-file-not multiline.i "(^|\\n)\\n" } } */
-/* { dg-bogus "missing term" "multiline strings" { target *-*-* } 11 } */
-/* { dg-bogus "warning" "warning in place of error" { target *-*-* } 15 } */
+/* { dg-warning "missing term" "multiline strings" { target *-*-* } 11 } */
+/* { dg-warning "missing term" "multiline strings" { target *-*-* } 14 } */
+/* { dg-warning "missing term" "multiline strings" { target *-*-* } 15 } */
+/* { dg-warning "missing term" "multiline strings" { target *-*-* } 18 } */
diff --git a/gcc/testsuite/gcc.dg/cpp/trad/literals-2.c b/gcc/testsuite/gcc.dg/cpp/trad/literals-2.c
index 29ffcbfbdeec..767ed77ffb8d 100644
--- a/gcc/testsuite/gcc.dg/cpp/trad/literals-2.c
+++ b/gcc/testsuite/gcc.dg/cpp/trad/literals-2.c
@@ -2,7 +2,7 @@
    recognized.  */
 
 /* { dg-do preprocess } */
-
+/* { dg-error "missing terminating" "bad charconst" { target *-*-* } 7 } */
 /* { dg-error "not valid" "bad charconst" { target *-*-* } 7 } */
 #if 'x
 #endif
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index b03241bff996..16cf1fc6c048 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,9 @@
+2006-09-13  Joseph S. Myers  <joseph@codesourcery.com>
+
+	PR c/28768
+	PR preprocessor/14634
+	* lex.c (lex_string): Pedwarn for unterminated literals.
+
 2006-09-08  Eric Christopher  <echristo@apple.com>
 
 	* configure.ac: Add 64-bit HWI support for i?86-darwin.
diff --git a/libcpp/lex.c b/libcpp/lex.c
index 6dc0fd9d8df5..df09bd6d3d68 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -646,6 +646,10 @@ lex_string (cpp_reader *pfile, cpp_token *token, const uchar *base)
     cpp_error (pfile, CPP_DL_WARNING,
 	       "null character(s) preserved in literal");
 
+  if (type == CPP_OTHER && CPP_OPTION (pfile, lang) != CLK_ASM)
+    cpp_error (pfile, CPP_DL_PEDWARN, "missing terminating %c character",
+	       (int) terminator);
+
   pfile->buffer->cur = cur;
   create_literal (pfile, token, base, cur - base, type);
 }
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 62ed9e9353a2..5a5f3030e096 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,11 @@
+2006-09-13  Joseph S. Myers  <joseph@codesourcery.com>
+
+	PR c/28768
+	PR preprocessor/14634
+	* configure.ac (HAVE_CLOCK_GETTIME): Add missing second argument
+	to AC_DEFINE.
+	* configure: Regenerate.
+
 2006-09-08  Steven G. Kargl  <kargl@gcc.gnu.org>
 
 	* testsuite/libgomp.fortran/reduction3.f90: Change
diff --git a/libgomp/configure b/libgomp/configure
index 28e3c998a369..f14cb657ade4 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -5831,8 +5831,9 @@ fi
   break
 done
 if test "$acx_cv_header_stdint" = stddef.h; then
-  acx_cv_header_stdint_kind="(lacks uintptr_t)"
+  acx_cv_header_stdint_kind="(lacks uintmax_t)"
   for i in stdint.h $inttype_headers; do
+    unset ac_cv_type_uintptr_t
     unset ac_cv_type_uint32_t
     unset ac_cv_type_uint64_t
     echo $ECHO_N "looking for an incomplete stdint.h in $i, $ECHO_C" >&6
@@ -5958,11 +5959,65 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5
 echo "${ECHO_T}$ac_cv_type_uint64_t" >&6
-if test $ac_cv_type_uint64_t = yes; then
-  :
+
+    echo "$as_me:$LINENO: checking for uintptr_t" >&5
+echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6
+if test "${ac_cv_type_uintptr_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  acx_cv_header_stdint_kind="(lacks uintptr_t and uint64_t)"
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <$i>
+
+int
+main ()
+{
+if ((uintptr_t *) 0)
+  return 0;
+if (sizeof (uintptr_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_uintptr_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_uintptr_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
+echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6
 
     break
   done
@@ -6095,11 +6150,6 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_type_u_int64_t" >&5
 echo "${ECHO_T}$ac_cv_type_u_int64_t" >&6
-if test $ac_cv_type_u_int64_t = yes; then
-  :
-else
-  acx_cv_header_stdint_kind="(u_intXX_t style, lacks u_int64_t)"
-fi
 
     break
   done
@@ -8755,8 +8805,9 @@ echo "$as_me:$LINENO: result: $ac_cv_lib_rt_clock_gettime" >&5
 echo "${ECHO_T}$ac_cv_lib_rt_clock_gettime" >&6
 if test $ac_cv_lib_rt_clock_gettime = yes; then
   LIBS="-lrt $LIBS"
-     cat >>confdefs.h <<\_ACEOF
-#define HAVE_CLOCK_GETTIME Define to 1 if you have the `clock_gettime' function.
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_CLOCK_GETTIME 1
 _ACEOF
 
 fi
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 5d11982b157a..d6f960e38335 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -227,7 +227,7 @@ esac
 if test $ac_cv_func_clock_gettime = no; then
   AC_CHECK_LIB(rt, clock_gettime,
     [LIBS="-lrt $LIBS"
-     AC_DEFINE(HAVE_CLOCK_GETTIME,
+     AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
 	       [Define to 1 if you have the `clock_gettime' function.])])
 fi
 
-- 
GitLab