X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/b7171c45f4eab4d06810d7e9617193cf62d08d38..952416114729b95209dccfc4edacfc1ff13b4e82:/tests/local.at diff --git a/tests/local.at b/tests/local.at index 7948faa5..5a459c64 100644 --- a/tests/local.at +++ b/tests/local.at @@ -2,7 +2,7 @@ # Macros for the GNU Bison Test suite. -# Copyright (C) 2003-2013 Free Software Foundation, Inc. +# Copyright (C) 2003-2015 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -635,9 +635,12 @@ m4_define([AT_BISON_CHECK_], # ---------------------------------------------------------- # Check that warnings (if some are expected) are correctly # turned into errors with -Werror, etc. +# +# When -Wno-error is used, the rules are really different, don't try. m4_define([AT_BISON_CHECK_WARNINGS], [m4_if(m4_bregexp([$4], [: warning: ]), [-1], [], - [m4_null_if([$2], [AT_BISON_CHECK_WARNINGS_($@)])])]) + m4_bregexp([$1], [-Wno-error=]), [-1], + [m4_null_if([$2], [AT_BISON_CHECK_WARNINGS_($@)])])]) m4_define([AT_BISON_CHECK_WARNINGS_], [[# Defining POSIXLY_CORRECT causes bison to complain if options are @@ -872,6 +875,49 @@ AT_PARSER_CHECK([./c-and-cxx]) ]) +# AT_SKIP_IF_EXCEPTION_SUPPORT_IS_POOR +# ------------------------------------ +# Check that we can expect exceptions to be handled properly. +# GCC 4.3 and 4.4 fail https://trac.macports.org/ticket/40853. +m4_define([AT_SKIP_IF_EXCEPTION_SUPPORT_IS_POOR], +[AT_DATA_SOURCE([exception.cc], +[[#include +#include + +void foo() +{ + try + { + throw std::runtime_error("foo"); + } + catch (...) + { + std::cerr << "Inner caught" << std::endl; + throw; + } +} + +int main() +{ + try + { + foo(); + } + catch (...) + { + std::cerr << "Outer caught" << std::endl; + return 0; + } + return 1; +} +]]) +AT_COMPILE_CXX([exception]) +# The "empty" quadrigraph is to protect from cfg.mk's +# sc_at_parser_check. +AT_CHECK([@&t@./exception || exit 77], [0], [], [ignore]) +]) + + ## ---------------------------- ## ## Running a generated parser. ## ## ---------------------------- ##