aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@casey.cygnus.com>2000-03-10 11:56:00 +0000
committerJason Merrill <jason@gcc.gnu.org>2000-03-10 06:56:00 -0500
commit1660cb3ac4068304926550396c9da9fb26e26b74 (patch)
tree64d2573001d0d41dba0b3e2f6df81872d766ceec
parent0c11ada67b89f4103c6c4abf680149bc3dee0959 (diff)
downloadgcc-1660cb3ac4068304926550396c9da9fb26e26b74.zip
gcc-1660cb3ac4068304926550396c9da9fb26e26b74.tar.gz
gcc-1660cb3ac4068304926550396c9da9fb26e26b74.tar.bz2
lang-options.h, decl2.c: Add -fno-enforce-eh-specs.
* lang-options.h, decl2.c: Add -fno-enforce-eh-specs. * cp-tree.h: Declare flag_enforce_eh_specs. * decl.c (store_parm_decls, finish_function): Check it. C library functions don't throw. * Makefile.in (cfns.h): New target. (except.o): Depend on it. * Make-lang.in (cc1plus): Depend on cfns.gperf. * cfns.gperf: New file. * cfns.h: Generated. * except.c: Include it. (nothrow_libfn_p): New fn. * decl.c (grokfndecl): Use it. * cp-tree.h: Declare it. From-SVN: r32469
-rw-r--r--gcc/cp/ChangeLog15
-rw-r--r--gcc/cp/Make-lang.in2
-rw-r--r--gcc/cp/Makefile.in6
-rw-r--r--gcc/cp/cfns.gperf219
-rw-r--r--gcc/cp/cfns.h459
-rw-r--r--gcc/cp/cp-tree.h7
-rw-r--r--gcc/cp/decl.c5
-rw-r--r--gcc/cp/decl2.c8
-rw-r--r--gcc/cp/except.c27
-rw-r--r--gcc/cp/lang-options.h2
10 files changed, 748 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e549057..d518d73 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,20 @@
2000-03-10 Jason Merrill <jason@casey.cygnus.com>
+ * lang-options.h, decl2.c: Add -fno-enforce-eh-specs.
+ * cp-tree.h: Declare flag_enforce_eh_specs.
+ * decl.c (store_parm_decls, finish_function): Check it.
+
+ C library functions don't throw.
+ * Makefile.in (cfns.h): New target.
+ (except.o): Depend on it.
+ * Make-lang.in (cc1plus): Depend on cfns.gperf.
+ * cfns.gperf: New file.
+ * cfns.h: Generated.
+ * except.c: Include it.
+ (nothrow_libfn_p): New fn.
+ * decl.c (grokfndecl): Use it.
+ * cp-tree.h: Declare it.
+
* decl.c (push_overloaded_decl_1, auto_function,
define_function): Lose.
(build_library_fn_1): New static fn.
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index 943b6da..745e033 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -123,7 +123,7 @@ CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/class.c $(srcdir)/cp/cp-tree.def \
cc1plus$(exeext): $(P) $(CXX_SRCS) $(LIBDEPS) stamp-objlist c-common.o \
c-pragma.o $(srcdir)/cp/cp-tree.h $(srcdir)/cp/cp-tree.def \
- $(srcdir)/cp/gxx.gperf hash.o
+ $(srcdir)/cp/gxx.gperf $(srcdir)/cp/cfns.gperf hash.o
cd cp; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) ../cc1plus$(exeext)
#
# Build hooks:
diff --git a/gcc/cp/Makefile.in b/gcc/cp/Makefile.in
index 27147f6..43bebf5 100644
--- a/gcc/cp/Makefile.in
+++ b/gcc/cp/Makefile.in
@@ -242,6 +242,10 @@ $(srcdir)/hash.h: $(srcdir)/gxx.gperf
echo " ftp://sourceware.cygnus.com/pub/egcs/infrastructure/gperf*" >&2 ; \
exit 1 )
+$(srcdir)/cfns.h: $(srcdir)/cfns.gperf
+ gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' \
+ $(srcdir)/cfns.gperf > $(srcdir)/cfns.h
+
spew.o : spew.c $(CXX_TREE_H) $(PARSE_H) $(srcdir)/../flags.h \
lex.h $(srcdir)/../toplev.h
lex.o : lex.c $(CXX_TREE_H) \
@@ -283,7 +287,7 @@ ptree.o : ptree.c $(CXX_TREE_H) $(srcdir)/../system.h
rtti.o : rtti.c $(CXX_TREE_H) $(srcdir)/../flags.h \
$(srcdir)/../toplev.h
except.o : except.c $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \
- $(srcdir)/../except.h $(srcdir)/../toplev.h
+ $(srcdir)/../except.h $(srcdir)/../toplev.h cfns.h
expr.o : expr.c $(CXX_TREE_H) $(RTL_H) $(srcdir)/../flags.h \
$(EXPR_H) $(srcdir)/../toplev.h $(srcdir)/../except.h
xref.o : xref.c $(CXX_TREE_H) $(srcdir)/../input.h \
diff --git a/gcc/cp/cfns.gperf b/gcc/cp/cfns.gperf
new file mode 100644
index 0000000..d7a530a
--- /dev/null
+++ b/gcc/cp/cfns.gperf
@@ -0,0 +1,219 @@
+# The standard C library functions, for feeding to gperf; the result is used
+# by nothrow_libfn_p.
+#
+# [lib.res.on.exception.handling]: None of the functions from the
+# Standard C library shall report an error by throwing an
+# exception, unless it calls a program-supplied function that
+# throws an exception.
+#
+# bsearch and qsort are commented out because they can call such functions.
+#
+abort
+abs
+acos
+asctime
+asin
+atan
+atan2
+atexit
+atof
+atoi
+atol
+#bsearch
+btowc
+calloc
+ceil
+clearerr
+clock
+cos
+cosh
+ctime
+difftime
+div
+exit
+exp
+fabs
+fclose
+feof
+ferror
+fflush
+fgetc
+fgetpos
+fgets
+fgetwc
+fgetws
+floor
+fmod
+fopen
+fprintf
+fputc
+fputs
+fputwc
+fputws
+fread
+free
+freopen
+frexp
+fscanf
+fseek
+fsetpos
+ftell
+fwide
+fwprintf
+fwrite
+fwscanf
+getc
+getchar
+getenv
+gets
+getwc
+getwchar
+gmtime
+isalnum
+isalpha
+iscntrl
+isdigit
+isgraph
+islower
+isprint
+ispunct
+isspace
+isupper
+iswalnum
+iswalpha
+iswcntrl
+iswctype
+iswdigit
+iswgraph
+iswlower
+iswprint
+iswpunct
+iswspace
+iswupper
+iswxdigit
+isxdigit
+labs
+ldexp
+ldiv
+localeconv
+localtime
+log
+log10
+longjmp
+malloc
+mblen
+mbrlen
+mbrtowc
+mbsinit
+mbsrtowcs
+mbstowcs
+mbtowc
+memchr
+memcmp
+memcpy
+memmove
+memset
+mktime
+modf
+perror
+pow
+printf
+putc
+putchar
+puts
+putwc
+putwchar
+#qsort
+raise
+rand
+realloc
+remove
+rename
+rewind
+scanf
+setbuf
+setlocale
+setvbuf
+signal
+sin
+sinh
+sprintf
+sqrt
+srand
+sscanf
+strcat
+strchr
+strcmp
+strcoll
+strcpy
+strcspn
+strerror
+strftime
+strlen
+strncat
+strncmp
+strncpy
+strpbrk
+strrchr
+strspn
+strstr
+strtod
+strtok
+strtol
+strtoul
+strxfrm
+swprintf
+swscanf
+system
+tan
+tanh
+time
+tmpfile
+tmpnam
+tolower
+toupper
+towctrans
+towlower
+towupper
+ungetc
+ungetwc
+vfprintf
+vfwprintf
+vprintf
+vsprintf
+vswprintf
+vwprintf
+wcrtomb
+wcscat
+wcschr
+wcscmp
+wcscoll
+wcscpy
+wcscspn
+wcsftime
+wcslen
+wcsncat
+wcsncmp
+wcsncpy
+wcspbrk
+wcsrchr
+wcsrtombs
+wcsspn
+wcsstr
+wcstod
+wcstok
+wcstol
+wcstombs
+wcstoul
+wcsxfrm
+wctob
+wctomb
+wctrans
+wctype
+wmemchr
+wmemcmp
+wmemcpy
+wmemmove
+wmemset
+wprintf
+wscanf
diff --git a/gcc/cp/cfns.h b/gcc/cp/cfns.h
new file mode 100644
index 0000000..df8c7b5
--- /dev/null
+++ b/gcc/cp/cfns.h
@@ -0,0 +1,459 @@
+/* C code produced by gperf version 2.7 */
+/* Command-line: gperf -o -C -E -k 1-6,$ -j1 -D -N libc_name_p /home/jason/eg/gcc/cp/cfns.gperf */
+/* maximum key range = 1020, duplicates = 1 */
+
+#ifdef __GNUC__
+__inline
+#endif
+static unsigned int
+hash (str, len)
+ register const char *str;
+ register unsigned int len;
+{
+ static const unsigned short asso_values[] =
+ {
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 0, 1,
+ 0, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 247, 218, 144,
+ 0, 0, 40, 7, 126, 184, 2, 15, 146, 67,
+ 9, 60, 0, 0, 3, 0, 7, 8, 197, 1,
+ 40, 8, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
+ 1038, 1038, 1038, 1038, 1038, 1038
+ };
+ register int hval = len;
+
+ switch (hval)
+ {
+ default:
+ case 6:
+ hval += asso_values[(unsigned char)str[5]];
+ case 5:
+ hval += asso_values[(unsigned char)str[4]];
+ case 4:
+ hval += asso_values[(unsigned char)str[3]];
+ case 3:
+ hval += asso_values[(unsigned char)str[2]];
+ case 2:
+ hval += asso_values[(unsigned char)str[1]];
+ case 1:
+ hval += asso_values[(unsigned char)str[0]];
+ break;
+ }
+ return hval + asso_values[(unsigned char)str[len - 1]];
+}
+
+#ifdef __GNUC__
+__inline
+#endif
+const char *
+libc_name_p (str, len)
+ register const char *str;
+ register unsigned int len;
+{
+ enum
+ {
+ TOTAL_KEYWORDS = 207,
+ MIN_WORD_LENGTH = 3,
+ MAX_WORD_LENGTH = 10,
+ MIN_HASH_VALUE = 18,
+ MAX_HASH_VALUE = 1037
+ };
+
+ static const char * const wordlist[] =
+ {
+ "gets",
+ "puts",
+ "sqrt",
+ "strerror",
+ "strstr",
+ "strspn",
+ "exp",
+ "free",
+ "fgets",
+ "fputs",
+ "fgetws",
+ "fputws",
+ "pow",
+ "fseek",
+ "perror",
+ "strtod",
+ "toupper",
+ "towupper",
+ "frexp",
+ "strtok",
+ "fsetpos",
+ "ferror",
+ "freopen",
+ "fgetpos",
+ "fopen",
+ "wmemset",
+ "memset",
+ "system",
+ "wcsstr",
+ "wctype",
+ "strxfrm",
+ "wcsspn",
+ "strcspn",
+ "fmod",
+ "strcpy",
+ "strncpy",
+ "strlen",
+ "ungetwc",
+ "feof",
+ "ldexp",
+ "isupper",
+ "rewind",
+ "iswupper",
+ "sin",
+ "cos",
+ "modf",
+ "iswpunct",
+ "wcstod",
+ "log10",
+ "log",
+ "wcsrtombs",
+ "strcmp",
+ "fwide",
+ "towctrans",
+ "strncmp",
+ "strtoul",
+ "fwrite",
+ "exit",
+ "swprintf",
+ "wcstok",
+ "strftime",
+ "sprintf",
+ "wprintf",
+ "strpbrk",
+ "time",
+ "rand",
+ "srand",
+ "wmemmove",
+ "tan",
+ "tolower",
+ "fwprintf",
+ "towlower",
+ "wcstombs",
+ "printf",
+ "fprintf",
+ "strchr",
+ "strrchr",
+ "wmemcpy",
+ "fread",
+ "getwchar",
+ "putwchar",
+ "longjmp",
+ "memcpy",
+ "wcsxfrm",
+ "wcscspn",
+ "getc",
+ "putc",
+ "getwc",
+ "putwc",
+ "wcscpy",
+ "wcsncpy",
+ "wcslen",
+ "floor",
+ "setbuf",
+ "ungetc",
+ "rename",
+ "remove",
+ "gmtime",
+ "mktime",
+ "fgetc",
+ "fputc",
+ "fgetwc",
+ "fputwc",
+ "memcmp",
+ "iswctype",
+ "wmemcmp",
+ "ispunct",
+ "mbstowcs",
+ "wcscmp",
+ "mbsrtowcs",
+ "setlocale",
+ "wcsncmp",
+ "wcstoul",
+ "strtol",
+ "wcsftime",
+ "iswprint",
+ "wcspbrk",
+ "iswdigit",
+ "isprint",
+ "fclose",
+ "atof",
+ "islower",
+ "iswlower",
+ "ctime",
+ "wmemchr",
+ "memchr",
+ "wctrans",
+ "strcat",
+ "getenv",
+ "strncat",
+ "iswxdigit",
+ "wcschr",
+ "wcsrchr",
+ "isxdigit",
+ "vswprintf",
+ "raise",
+ "iswspace",
+ "vsprintf",
+ "vwprintf",
+ "vprintf",
+ "swscanf",
+ "sinh",
+ "tmpfile",
+ "asin",
+ "mblen",
+ "acos",
+ "mbrlen",
+ "cosh",
+ "difftime",
+ "memmove",
+ "abs",
+ "tmpnam",
+ "vfwprintf",
+ "setvbuf",
+ "vfprintf",
+ "scanf",
+ "sscanf",
+ "wscanf",
+ "fwscanf",
+ "ftell",
+ "fflush",
+ "atexit",
+ "iswcntrl",
+ "iscntrl",
+ "mbrtowc",
+ "wcrtomb",
+ "fabs",
+ "wcstol",
+ "strcoll",
+ "atan2",
+ "tanh",
+ "atan",
+ "fscanf",
+ "clock",
+ "getchar",
+ "putchar",
+ "abort",
+ "clearerr",
+ "wcscat",
+ "wcsncat",
+ "isdigit",
+ "isgraph",
+ "iswgraph",
+ "btowc",
+ "div",
+ "isspace",
+ "atol",
+ "labs",
+ "ceil",
+ "mbtowc",
+ "wcscoll",
+ "wctob",
+ "asctime",
+ "iswalnum",
+ "isalnum",
+ "mbsinit",
+ "atoi",
+ "wctomb",
+ "ldiv",
+ "signal",
+ "realloc",
+ "localtime",
+ "iswalpha",
+ "localeconv",
+ "isalpha",
+ "malloc",
+ "calloc"
+ };
+
+ static const short lookup[] =
+ {
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 0, 1, -1, 2, -1, -1,
+ -1, -1, -1, 3, -1, 4, -1, -1,
+ -1, -1, 5, -1, -1, -1, -1, -1,
+ -1, -1, -1, 6, -1, -1, -1, 7,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 8, 9, 10, 11, -1,
+ -1, 12, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 13, -1, -1, 14, -1,
+ -1, -1, -1, 15, -1, 16, -1, 17,
+ 18, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 19, 20, -1, -1, -1, 21, 22,
+ -1, 23, -1, 24, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 25, -1, -1,
+ -1, -1, 26, 27, -1, -1, -1, -1,
+ -1, -1, -1, -1, 28, -1, 29, 30,
+ -1, 31, 32, 33, -1, -1, -1, -1,
+ 34, -1, 35, -1, 36, -1, -1, 37,
+ 38, -1, -1, -1, -1, -1, -1, 39,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 40, 41, 42, 43, -1, 44,
+ -1, -1, -1, 45, -1, -1, -1, -1,
+ -1, 46, 47, 48, -1, -1, -1, 49,
+ 50, -1, -1, 51, -1, -1, 52, 53,
+ -1, -1, -1, -1, -1, 54, 55, -1,
+ -1, 56, 57, -1, -1, 58, -1, -1,
+ 59, 60, 61, 62, -1, 63, -1, -1,
+ -1, -1, -1, -1, -1, -1, 64, 65,
+ 66, -1, -1, -1, -1, -1, 67, -1,
+ -1, -1, -1, 68, -1, -1, -1, -1,
+ -1, -1, -1, -1, 69, 70, 71, 72,
+ -1, 73, 74, -1, 75, 76, 77, 78,
+ 79, 80, 81, -1, 82, -1, 83, -1,
+ -1, 84, 85, 86, 87, 88, -1, 89,
+ -1, 90, -1, 91, -1, 92, -1, 93,
+ -1, -1, -1, -1, -1, 94, -1, -1,
+ -1, -1, -1, -1, 95, 96, -1, -1,
+ -1, -1, 97, -1, -1, -1, -1, -1,
+ -1, -1, 98, 99, 100, 101, 102, 103,
+ 104, 105, -1, -1, -1, -1, -1, 106,
+ -1, 107, 108, -1, 109, -1, 110, -1,
+ -1, -1, -1, -1, 111, 112, -1, 113,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ 114, -1, -1, 115, 116, -1, -1, 117,
+ -1, -1, 118, -1, 119, -1, 120, -1,
+ -1, 121, -1, 122, -1, -1, -1, 123,
+ -1, -1, -1, -1, -1, -1, -1, 124,
+ 125, -1, 126, -1, -1, 127, -1, 128,
+ 129, 130, -1, 131, 132, -1, 133, -1,
+ -1, -1, 134, -1, -1, -1, -1, 135,
+ 136, 137, 138, -1, -1, -1, -1, 139,
+ 140, 141, -1, 142, -1, 143, 144, 145,
+ -1, -1, 146, -1, 147, -1, -1, 148,
+ -1, 149, -1, -1, 150, -1, 151, -1,
+ -1, -1, 152, -1, -1, 153, -1, -1,
+ -1, 154, -1, -1, -1, 155, 156, 157,
+ 158, -1, 159, -1, 160, -1, -1, -1,
+ -1, -1, 161, 162, 163, -1, -1, -1,
+ -1, -1, -1, -719, -1, 166, 167, -43,
+ -2, 168, -1, 169, -1, -1, -1, 170,
+ -1, -1, -1, 171, -1, -1, 172, -1,
+ -1, 173, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 174, 175, -1,
+ -1, -1, -1, 176, -1, -1, -1, 177,
+ -1, -1, -1, -1, 178, -1, -1, 179,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 180, 181, -1,
+ 182, -1, -1, 183, -1, 184, 185, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 186, -1, -1, -1, -1, 187,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ 188, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 189,
+ 190, -1, -1, -1, -1, 191, -1, -1,
+ 192, -1, -1, -1, -1, -1, 193, -1,
+ -1, -1, -1, -1, 194, -1, -1, -1,
+ -1, -1, -1, -1, 195, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 196, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 197, -1, -1, -1, -1, -1, -1,
+ 198, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 199, -1, -1, -1, -1, -1, -1,
+ -1, 200, -1, -1, -1, -1, -1, 201,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 202, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 203, -1,
+ -1, -1, -1, -1, -1, 204, -1, -1,
+ 205, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 206
+ };
+
+ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
+ {
+ register int key = hash (str, len);
+
+ if (key <= MAX_HASH_VALUE && key >= 0)
+ {
+ register int index = lookup[key];
+
+ if (index >= 0)
+ {
+ register const char *s = wordlist[index];
+
+ if (*str == *s && !strcmp (str + 1, s + 1))
+ return s;
+ }
+ else if (index < -TOTAL_KEYWORDS)
+ {
+ register int offset = - 1 - TOTAL_KEYWORDS - index;
+ register const char * const *wordptr = &wordlist[TOTAL_KEYWORDS + lookup[offset]];
+ register const char * const *wordendptr = wordptr + -lookup[offset + 1];
+
+ while (wordptr < wordendptr)
+ {
+ register const char *s = *wordptr;
+
+ if (*str == *s && !strcmp (str + 1, s + 1))
+ return s;
+ wordptr++;
+ }
+ }
+ }
+ }
+ return 0;
+}
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index f7baceb..9c348a0 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -1149,6 +1149,12 @@ extern int flag_vtable_gc;
The value of this flag is ignored if -pedantic is specified. */
extern int flag_permissive;
+/* Nonzero means to implement standard semantics for exception
+ specifications, calling unexpected if an exception is thrown that
+ doesn't match the specification. Zero means to treat them as
+ assertions and optimize accordingly, but not check them. */
+extern int flag_enforce_eh_specs;
+
/* Nonzero if we want to obey access control semantics. */
extern int flag_access_control;
@@ -3922,6 +3928,7 @@ extern void expand_end_eh_spec PARAMS ((tree, tree));
extern void expand_exception_blocks PARAMS ((void));
extern tree build_throw PARAMS ((tree));
extern void mark_all_runtime_matches PARAMS ((void));
+extern int nothrow_libfn_p PARAMS ((tree));
/* in expr.c */
extern void init_cplus_expand PARAMS ((void));
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 7133190..53cbb74 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -8668,6 +8668,9 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
tentative. error_mark_node is replaced later with the BLOCK. */
DECL_INITIAL (decl) = error_mark_node;
+ if (nothrow_libfn_p (decl))
+ TREE_NOTHROW (decl) = 1;
+
/* Caller will do the rest of this. */
if (check < 0)
return decl;
@@ -13563,6 +13566,7 @@ store_parm_decls ()
/* Do the starting of the exception specifications, if we have any. */
if (flag_exceptions && !processing_template_decl
+ && flag_enforce_eh_specs
&& building_stmt_tree ()
&& TYPE_RAISES_EXCEPTIONS (TREE_TYPE (current_function_decl)))
current_eh_spec_try_block = expand_start_eh_spec ();
@@ -13840,6 +13844,7 @@ finish_function (lineno, flags)
/* Finish dealing with exception specifiers. */
if (flag_exceptions && !processing_template_decl
+ && flag_enforce_eh_specs
&& TYPE_RAISES_EXCEPTIONS (TREE_TYPE (current_function_decl)))
expand_end_eh_spec (TYPE_RAISES_EXCEPTIONS
(TREE_TYPE (current_function_decl)),
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 7f5ba6a3..851b402 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -490,6 +490,13 @@ int flag_vtable_gc;
int flag_permissive;
+/* Nonzero means to implement standard semantics for exception
+ specifications, calling unexpected if an exception is thrown that
+ doesn't match the specification. Zero means to treat them as
+ assertions and optimize accordingly, but not check them. */
+
+int flag_enforce_eh_specs = 1;
+
/* If this variable is defined to a non-NULL value, it will be called
after the file has been completely parsed. */
@@ -524,6 +531,7 @@ lang_f_options[] =
{"default-inline", &flag_default_inline, 1},
{"dollars-in-identifiers", &dollars_in_ident, 1},
{"elide-constructors", &flag_elide_constructors, 1},
+ {"enforce-eh-specs", &flag_enforce_eh_specs, 1},
{"external-templates", &flag_external_templates, 1},
{"for-scope", &flag_new_for_scope, 2},
{"gnu-keywords", &flag_no_gnu_keywords, 0},
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index ae64e78..3a54ea8 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -1027,3 +1027,30 @@ complete_ptr_ref_or_void_ptr_p (type, from)
return 1;
}
+/* Returns nonzero if FN is a declaration of a standard C library
+ function which is known not to throw.
+
+ [lib.res.on.exception.handling]: None of the functions from the
+ Standard C library shall report an error by throwing an
+ exception, unless it calls a program-supplied function that
+ throws an exception. */
+
+#include "cfns.h"
+
+int
+nothrow_libfn_p (fn)
+ tree fn;
+{
+ tree id;
+
+ if (TREE_PUBLIC (fn)
+ && DECL_EXTERNAL (fn)
+ && DECL_LANGUAGE (fn) == lang_c)
+ /* OK */;
+ else
+ /* Can't be a C library function. */
+ return 0;
+
+ id = DECL_ASSEMBLER_NAME (fn);
+ return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id));
+}
diff --git a/gcc/cp/lang-options.h b/gcc/cp/lang-options.h
index d6a65cd..9f3f6fe 100644
--- a/gcc/cp/lang-options.h
+++ b/gcc/cp/lang-options.h
@@ -45,6 +45,8 @@ DEFINE_LANG_NAME ("C++")
{ "-fno-rtti", "Do not generate run time type descriptor information" },
{ "-felide-constructors", "" },
{ "-fno-elide-constructors", "" },
+ { "-fenforce-eh-specs", "" },
+ { "-fno-enforce-eh-specs", "Do not generate code to check exception specifications" },
{ "-fenum-int-equiv", "" },
{ "-fno-enum-int-equiv", "" },
{ "-fexternal-templates", "" },