diff --git gcc/testsuite/c-c++-common/cpp/openmp-define-1.c gcc/testsuite/c-c++-common/cpp/openmp-define-1.c
new file mode 100644
index 0000000..0e7943a
--- /dev/null
+++ gcc/testsuite/c-c++-common/cpp/openmp-define-1.c
@@ -0,0 +1,6 @@
+/* { dg-require-effective-target fopenmp } */
+/* { dg-do preprocess } */
+
+#ifdef _OPENMP
+# error _OPENMP defined
+#endif
diff --git gcc/testsuite/c-c++-common/cpp/openmp-define-2.c gcc/testsuite/c-c++-common/cpp/openmp-define-2.c
new file mode 100644
index 0000000..f777789
--- /dev/null
+++ gcc/testsuite/c-c++-common/cpp/openmp-define-2.c
@@ -0,0 +1,7 @@
+/* { dg-require-effective-target fopenmp } */
+/* { dg-options "-fno-openmp" } */
+/* { dg-do preprocess } */
+
+#ifdef _OPENMP
+# error _OPENMP defined
+#endif
diff --git gcc/testsuite/c-c++-common/cpp/openmp-define-3.c gcc/testsuite/c-c++-common/cpp/openmp-define-3.c
new file mode 100644
index 0000000..6ea0425
--- /dev/null
+++ gcc/testsuite/c-c++-common/cpp/openmp-define-3.c
@@ -0,0 +1,11 @@
+/* { dg-require-effective-target fopenmp } */
+/* { dg-options "-fopenmp" } */
+/* { dg-do preprocess } */
+
+#ifndef _OPENMP
+# error _OPENMP not defined
+#endif
+
+#if _OPENMP != 201107
+# error _OPENMP defined to wrong value
+#endif
diff --git gcc/testsuite/gfortran.dg/openmp-define-1.f90 gcc/testsuite/gfortran.dg/openmp-define-1.f90
new file mode 100644
index 0000000..d4ef1d1
--- /dev/null
+++ gcc/testsuite/gfortran.dg/openmp-define-1.f90
@@ -0,0 +1,7 @@
+! { dg-require-effective-target fopenmp }
+! { dg-options "-cpp" }
+! { dg-do preprocess }
+
+#ifdef _OPENMP
+# error _OPENMP defined
+#endif
diff --git gcc/testsuite/gfortran.dg/openmp-define-2.f90 gcc/testsuite/gfortran.dg/openmp-define-2.f90
new file mode 100644
index 0000000..651dae7
--- /dev/null
+++ gcc/testsuite/gfortran.dg/openmp-define-2.f90
@@ -0,0 +1,7 @@
+! { dg-require-effective-target fopenmp }
+! { dg-options "-cpp -fno-openmp" }
+! { dg-do preprocess }
+
+#ifdef _OPENMP
+# error _OPENMP defined
+#endif
diff --git gcc/testsuite/gfortran.dg/openmp-define-3.f90 gcc/testsuite/gfortran.dg/openmp-define-3.f90
new file mode 100644
index 0000000..dfc45b1
--- /dev/null
+++ gcc/testsuite/gfortran.dg/openmp-define-3.f90
@@ -0,0 +1,11 @@
+! { dg-require-effective-target fopenmp }
+! { dg-options "-cpp -fopenmp" }
+! { dg-do preprocess }
+
+#ifndef _OPENMP
+# error _OPENMP not defined
+#endif
+
+#if _OPENMP != 201107
+# error _OPENMP defined to wrong value
+#endif
diff --git libgomp/testsuite/libgomp.fortran/openmp_version-1.f libgomp/testsuite/libgomp.fortran/openmp_version-1.f
new file mode 100644
index 0000000..aaa8881
--- /dev/null
+++ libgomp/testsuite/libgomp.fortran/openmp_version-1.f
@@ -0,0 +1,9 @@
+! { dg-do run }
+
+      program main
+      implicit none
+      include "omp_lib.h"
+
+      if (openmp_version .ne. 201107) call abort;
+
+      end program main
diff --git libgomp/testsuite/libgomp.fortran/openmp_version-2.f90 libgomp/testsuite/libgomp.fortran/openmp_version-2.f90
new file mode 100644
index 0000000..b2d1d26
--- /dev/null
+++ libgomp/testsuite/libgomp.fortran/openmp_version-2.f90
@@ -0,0 +1,9 @@
+! { dg-do run }
+
+program main
+  use omp_lib
+  implicit none
+
+  if (openmp_version .ne. 201107) call abort;
+
+end program main


libgomp/
	* configure.ac: Typo fix.
	* configure: Regenerate.

---
 libgomp/configure    | 2 +-
 libgomp/configure.ac | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git libgomp/configure.ac libgomp/configure.ac
index d87ed29..e7fbb31 100644
--- libgomp/configure.ac
+++ libgomp/configure.ac
@@ -238,7 +238,7 @@ fi
 # See if we support thread-local storage.
 GCC_CHECK_TLS
 
-# See what sort of export controls are availible.
+# See what sort of export controls are available.
 LIBGOMP_CHECK_ATTRIBUTE_VISIBILITY
 LIBGOMP_CHECK_ATTRIBUTE_DLLEXPORT
 LIBGOMP_CHECK_ATTRIBUTE_ALIAS


gcc/
	* tree.h (OMP_CLAUSE_CODE): Remove duplicate definition.

---
 gcc/tree.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git gcc/tree.h gcc/tree.h
index a71cd96..2ecda8a 100644
--- gcc/tree.h
+++ gcc/tree.h
@@ -1351,9 +1351,6 @@ extern void protected_set_expr_location (tree, location_t);
 #define OMP_CLAUSE_SET_CODE(NODE, CODE)				\
 	((OMP_CLAUSE_CHECK (NODE))->omp_clause.code = (CODE))
 
-#define OMP_CLAUSE_CODE(NODE)					\
-	(OMP_CLAUSE_CHECK (NODE))->omp_clause.code
-
 #define OMP_CLAUSE_OPERAND(NODE, I)				\
 	OMP_CLAUSE_ELT_CHECK (NODE, I)
 


libgomp/
	* testsuite/libgomp.c/lib-1.c (main): Add missing error check.
	* testsuite/libgomp.fortran/lib1.f90: Likewise.
	* testsuite/libgomp.fortran/lib2.f: Likewise.
	* testsuite/libgomp.fortran/lib3.f: Likewise.

---
 libgomp/testsuite/libgomp.c/lib-1.c        | 2 ++
 libgomp/testsuite/libgomp.fortran/lib1.f90 | 1 +
 libgomp/testsuite/libgomp.fortran/lib2.f   | 1 +
 libgomp/testsuite/libgomp.fortran/lib3.f   | 1 +
 4 files changed, 5 insertions(+)

diff --git libgomp/testsuite/libgomp.c/lib-1.c libgomp/testsuite/libgomp.c/lib-1.c
index 4839cf93..086036d 100644
--- libgomp/testsuite/libgomp.c/lib-1.c
+++ libgomp/testsuite/libgomp.c/lib-1.c
@@ -85,6 +85,8 @@ main (void)
   l = ! omp_in_parallel ();
 #pragma omp parallel reduction (|:l) if (1)
   l = ! omp_in_parallel ();
+  if (l)
+    abort ();
 
   e = omp_get_wtime ();
   if (d > e)
diff --git libgomp/testsuite/libgomp.fortran/lib1.f90 libgomp/testsuite/libgomp.fortran/lib1.f90
index 8840018..e7e1c74 100644
--- libgomp/testsuite/libgomp.fortran/lib1.f90
+++ libgomp/testsuite/libgomp.fortran/lib1.f90
@@ -66,6 +66,7 @@
 !$omp parallel reduction (.or.:l) if (.true.)
   l = .not. omp_in_parallel ()
 !$omp end parallel
+  if (l) call abort
 
   e = omp_get_wtime ()
   if (d .gt. e) call abort
diff --git libgomp/testsuite/libgomp.fortran/lib2.f libgomp/testsuite/libgomp.fortran/lib2.f
index 7551082..20db04a 100644
--- libgomp/testsuite/libgomp.fortran/lib2.f
+++ libgomp/testsuite/libgomp.fortran/lib2.f
@@ -66,6 +66,7 @@ C$OMP END PARALLEL
 C$OMP PARALLEL REDUCTION (.OR.:L) IF (.TRUE.)
       L = .NOT. OMP_IN_PARALLEL ()
 C$OMP END PARALLEL
+      IF (L) CALL ABORT
 
       E = OMP_GET_WTIME ()
       IF (D .GT. E) CALL ABORT
diff --git libgomp/testsuite/libgomp.fortran/lib3.f libgomp/testsuite/libgomp.fortran/lib3.f
index fa7b227..264a377 100644
--- libgomp/testsuite/libgomp.fortran/lib3.f
+++ libgomp/testsuite/libgomp.fortran/lib3.f
@@ -66,6 +66,7 @@ C$OMP END PARALLEL
 C$OMP PARALLEL REDUCTION (.OR.:L) IF (.TRUE.)
       L = .NOT. OMP_IN_PARALLEL ()
 C$OMP END PARALLEL
+      IF (L) CALL ABORT
 
       E = OMP_GET_WTIME ()
       IF (D .GT. E) CALL ABORT


libgomp/
	* libgomp.texi (Runtime Library Routines): C linkage, don't throw
	exceptions.

---
 libgomp/libgomp.texi | 2 ++
 1 file changed, 2 insertions(+)

diff --git libgomp/libgomp.texi libgomp/libgomp.texi
index 2985128..f674293 100644
--- libgomp/libgomp.texi
+++ libgomp/libgomp.texi
@@ -132,6 +132,8 @@ three parts:
 
 Control threads, processors and the parallel environment.
 
+They have C linkage, and don't throw exceptions.
+
 @menu
 * omp_get_active_level::        Number of active parallel regions
 * omp_get_ancestor_thread_num:: Ancestor thread ID


contrib/
	* gcc_update (files_and_dependencies): Fix rule for
	libgomp/testsuite/Makefile.in.

---
 contrib/gcc_update | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git contrib/gcc_update contrib/gcc_update
index bdf89c4..235c8a9 100755
--- contrib/gcc_update
+++ contrib/gcc_update
@@ -139,7 +139,7 @@ libcpp/Makefile.in: libcpp/configure.ac libcpp/aclocal.m4
 libcpp/configure: libcpp/configure.ac libcpp/aclocal.m4
 libgomp/aclocal.m4: libgomp/configure.ac libgomp/acinclude.m4
 libgomp/Makefile.in: libgomp/Makefile.am libgomp/aclocal.m4
-libgomp/testsuite/Makefile.in: libgomp/Makefile.am libgomp/aclocal.m4
+libgomp/testsuite/Makefile.in: libgomp/testsuite/Makefile.am libgomp/aclocal.m4
 libgomp/configure: libgomp/configure.ac libgomp/aclocal.m4
 libgomp/config.h.in: libgomp/configure.ac libgomp/aclocal.m4
 libitm/aclocal.m4: libitm/configure.ac libitm/acinclude.m4


libgomp/
	* Makefile.am (omp_lib.mod): Streamline rule.
	* Makefile.in: Regenerate.

---
 libgomp/Makefile.am | 2 +-
 libgomp/Makefile.in | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git libgomp/Makefile.am libgomp/Makefile.am
index 2bc4986..8cdd6a0 100644
--- libgomp/Makefile.am
+++ libgomp/Makefile.am
@@ -76,7 +76,7 @@ LINK = $(LIBTOOL) --tag CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
 omp_lib_kinds.mod: omp_lib.mod
 	:
 omp_lib.mod: omp_lib.f90
-	$(FC) $(FCFLAGS) -fsyntax-only omp_lib.f90
+	$(FC) $(FCFLAGS) -fsyntax-only $<
 fortran.lo: libgomp_f.h
 fortran.o: libgomp_f.h
 env.lo: libgomp_f.h
