summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-23 14:05:26 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-23 14:05:26 +0000
commitc822fc9b51ce3de2fe06fd2dbe66f166ca0664d5 (patch)
treeff57b9487691cf2fb581fa1a9ad47d175aef9fc7
parent16916f1a604870168111eb73a895a826c3a160ec (diff)
downloadgcc-c822fc9b51ce3de2fe06fd2dbe66f166ca0664d5.tar.gz
2011-11-23 Thomas Quinot <quinot@adacore.com>
* thread.c, s-oscons-tmplt.c: Generate __gnat_pthread_condattr_setup only on platforms where this is required, as determined by s-oscons.h. 2011-11-23 Ed Schonberg <schonberg@adacore.com> * sem_ch9.adb: No check on entry index if error on index. 2011-11-23 Gary Dismukes <dismukes@adacore.com> * sem_ch6.adb (Analyze_Return_Statement): Improve error messages for return statements nested inside an extended_return_statement. * gcc-interface/Make-lang.in: Update dependencies. * gcc-interface/Makefile.in (MISCLIB): Add -lutil for BSD targets. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181670 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog17
-rw-r--r--gcc/ada/gcc-interface/Make-lang.in37
-rw-r--r--gcc/ada/gcc-interface/Makefile.in3
-rw-r--r--gcc/ada/s-oscons-tmplt.c20
-rw-r--r--gcc/ada/sem_ch6.adb16
-rw-r--r--gcc/ada/sem_ch9.adb6
-rw-r--r--gcc/ada/thread.c23
7 files changed, 85 insertions, 37 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 56b2a1ee78b..4533244cd74 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,20 @@
+2011-11-23 Thomas Quinot <quinot@adacore.com>
+
+ * thread.c, s-oscons-tmplt.c: Generate __gnat_pthread_condattr_setup
+ only on platforms where this is required, as determined by
+ s-oscons.h.
+
+2011-11-23 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch9.adb: No check on entry index if error on index.
+
+2011-11-23 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_ch6.adb (Analyze_Return_Statement): Improve error messages for
+ return statements nested inside an extended_return_statement.
+ * gcc-interface/Make-lang.in: Update dependencies.
+ * gcc-interface/Makefile.in (MISCLIB): Add -lutil for BSD targets.
+
2011-11-23 Ed Schonberg <schonberg@adacore.com>
* freeze.adb (Freeze_All_Ent): An incomplete type is not
diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
index e6fd2a6aa49..44d75154779 100644
--- a/gcc/ada/gcc-interface/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -4047,7 +4047,7 @@ ada/sem_ch3.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/itypes.ads ada/layout.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
ada/lib-load.ads ada/lib-sort.adb ada/lib-util.ads ada/lib-xref.ads \
ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
- ada/nmake.adb ada/opt.ads ada/opt.adb ada/output.ads ada/par_sco.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/par_sco.ads \
ada/put_alfa.ads ada/restrict.ads ada/restrict.adb ada/rident.ads \
ada/rtsfind.ads ada/scans.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads \
ada/sem_aux.ads ada/sem_aux.adb ada/sem_case.ads ada/sem_case.adb \
@@ -4245,23 +4245,24 @@ ada/sem_ch8.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb ada/scans.ads \
ada/sem.ads ada/sem.adb ada/sem_aggr.ads ada/sem_attr.ads \
ada/sem_aux.ads ada/sem_aux.adb ada/sem_cat.ads ada/sem_ch10.ads \
- ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch2.ads \
- ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads \
- ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch8.adb ada/sem_ch9.ads \
- ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads ada/sem_elim.ads \
- ada/sem_eval.ads ada/sem_intr.ads ada/sem_prag.ads ada/sem_res.ads \
- ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
- ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads \
- ada/sinput.ads ada/sinput.adb ada/snames.ads ada/stand.ads \
- ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/stylesw.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
- ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tree_io.ads \
- ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch13.adb \
+ ada/sem_ch2.ads ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads \
+ ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch8.adb \
+ ada/sem_ch9.ads ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads \
+ ada/sem_elim.ads ada/sem_eval.ads ada/sem_intr.ads ada/sem_prag.ads \
+ ada/sem_res.ads ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads \
+ ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
+ ada/sinfo-cn.ads ada/sinput.ads ada/sinput.adb ada/snames.ads \
+ ada/stand.ads ada/stringt.ads ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-exctab.ads \
+ ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
+ ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/warnsw.ads ada/widechar.ads
ada/sem_ch9.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index f281c90fe69..ad8917fcd29 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -1156,6 +1156,7 @@ ifeq ($(strip $(filter-out %86 kfreebsd%,$(arch) $(osys))),)
GNATLIB_SHARED = gnatlib-shared-dual
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
+ MISCLIB = -lutil
endif
ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(arch) $(osys))),)
@@ -1209,6 +1210,7 @@ ifeq ($(strip $(filter-out %86 freebsd%,$(arch) $(osys))),)
THREADSLIB= -lpthread
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
+ MISCLIB = -lutil
endif
ifeq ($(strip $(filter-out %86_64 freebsd%,$(arch) $(osys))),)
@@ -1235,6 +1237,7 @@ ifeq ($(strip $(filter-out %86_64 freebsd%,$(arch) $(osys))),)
THREADSLIB= -lpthread
GMEM_LIB = gmemlib
LIBRARY_VERSION := $(LIB_VERSION)
+ MISCLIB = -lutil
endif
ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)
diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c
index 7b247937639..3d70ceb4857 100644
--- a/gcc/ada/s-oscons-tmplt.c
+++ b/gcc/ada/s-oscons-tmplt.c
@@ -1360,13 +1360,22 @@ CND(CLOCK_SGI_FAST, "SGI fast clock")
CND(CLOCK_SGI_CYCLE, "SGI CPU clock")
#endif
+#ifndef CLOCK_THREAD_CPUTIME_ID
+# define CLOCK_THREAD_CPUTIME_ID -1
+#endif
+CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
+
#if defined(__APPLE__)
-/* There's no clock_gettime or clock_id's on Darwin */
+/* There's no clock_gettime or clock_id's on Darwin, generate a dummy value */
# define CLOCK_RT_Ada "-1"
-#elif defined(FreeBSD) || defined(_AIX)
-/* On these platforms use system provided monotonic clock */
+#elif defined(FreeBSD) || (defined(_AIX) && defined(_AIXVERSION_530))
+/** On these platforms use system provided monotonic clock instead of
+ ** the default CLOCK_REALTIME. We then need to set up cond var attributes
+ ** appropriately (see thread.c).
+ **/
# define CLOCK_RT_Ada "CLOCK_MONOTONIC"
+# define NEED_PTHREAD_CONDATTR_SETCLOCK
#elif defined(CLOCK_REALTIME)
/* By default use CLOCK_REALTIME */
@@ -1377,11 +1386,6 @@ CND(CLOCK_SGI_CYCLE, "SGI CPU clock")
CNS(CLOCK_RT_Ada, "")
#endif
-#ifndef CLOCK_THREAD_CPUTIME_ID
-# define CLOCK_THREAD_CPUTIME_ID -1
-#endif
-CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
-
#if defined (__APPLE__) || defined (__linux__) || defined (DUMMY)
/*
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 4a44e43c151..780a916bc2d 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -1485,9 +1485,19 @@ package body Sem_Ch6 is
-- extended_return_statement.
if Returns_Object then
- Error_Msg_N
- ("extended_return_statement cannot return value; " &
- "use `""RETURN;""`", N);
+ if Nkind (N) = N_Extended_Return_Statement then
+ Error_Msg_N
+ ("extended return statements cannot be nested; use `RETURN;`",
+ N);
+
+ -- Case of a simple return statement with a value inside extended
+ -- return statement.
+
+ else
+ Error_Msg_N
+ ("return nested in extended return statement cannot return " &
+ "value; use `RETURN;`", N);
+ end if;
end if;
else
diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb
index 16b8087ad66..35c4eeebda0 100644
--- a/gcc/ada/sem_ch9.adb
+++ b/gcc/ada/sem_ch9.adb
@@ -924,8 +924,13 @@ package body Sem_Ch9 is
UBR : Node_Id;
begin
+
+ -- No bounds checking if the type is generic or if previous error.
+ -- In an instance the check is dynamic.
+
if Is_Generic_Type (Etype (D_Sdef))
or else In_Instance
+ or else Error_Posted (D_Sdef)
then
goto Skip_LB;
@@ -951,6 +956,7 @@ package body Sem_Ch9 is
<<Skip_LB>>
if Is_Generic_Type (Etype (D_Sdef))
or else In_Instance
+ or else Error_Posted (D_Sdef)
then
goto Skip_UB;
diff --git a/gcc/ada/thread.c b/gcc/ada/thread.c
index da67f7b1cd2..a55accefef0 100644
--- a/gcc/ada/thread.c
+++ b/gcc/ada/thread.c
@@ -2,7 +2,7 @@
* *
* GNAT COMPILER COMPONENTS *
* *
- * T H R E A D *
+ * P T H R E A D *
* *
* C Implementation File *
* *
@@ -31,20 +31,27 @@
/* This file provides utility functions to access the threads API */
-#include <pthread.h>
-#include <time.h>
#include "s-oscons.h"
+#ifdef NEED_PTHREAD_CONDATTR_SETCLOCK
+# include <pthread.h>
+# include <time.h>
+
int
__gnat_pthread_condattr_setup(pthread_condattr_t *attr) {
/*
* If using a clock other than CLOCK_REALTIME for the Ada Monotonic_Clock,
* the corresponding clock id must be set for condition variables.
- * There are no clock_id's on Darwin.
*/
-#if defined(__APPLE__) || ((CLOCK_RT_Ada) == (CLOCK_REALTIME))
- return 0;
-#else
return pthread_condattr_setclock (attr, CLOCK_RT_Ada);
-#endif
}
+
+#else
+
+int
+__gnat_pthread_condattr_setup (void *attr) {
+ /* Dummy version for other platforms, which may or may not have pthread.h */
+ return 0;
+}
+
+#endif