# Executing Actions. -*- Autotest -*-
-# Copyright (C) 2002, 2004, 2005, 2007, 2009 Free Software Foundation,
-# Inc.
+# Copyright (C) 2002, 2004-2005, 2007, 2009-2010 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
# =>
# input.y:4: #error "4"
#
-AT_CHECK([[sed -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' -e 's/^\([^:]*:[^:]*:\)[^@%:@]*\( @%:@error\)/\1\2/' stderr]], 0, [stdout])
+# It may also issue more context information:
+#
+# input.y: In function 'yyparse':
+# input.y:8: #error "8"
+# =>
+# input.y:4: #error "8"
+#
+#
+# And possibly distcc adds its bits.
+#
+# distcc[33187] ERROR: compile (null) on localhost failed
+# syncline.c:1:2: error: #error "1"
+# distcc[33185] ERROR: compile syncline.c on localhost failed
+
+AT_CHECK([[sed -e '/^distcc\[[0-9]*\] ERROR: .*/d' \
+ -e 's/^\([^:]*:[^:.]*\)[.:][^:]*:\(.*\)$/\1:\2/' \
+ -e 's/^\([^:]*:[^:]*:\)[^@%:@]*\( @%:@error\)/\1\2/' \
+ -e "/^[^:]*: In function '[^\']*':$/d" \
+ stderr]],
+ 0, [stdout])
])
# AT_TEST_SYNCLINE(TITLE, INPUT, ERROR-MSG)
AT_DATA([[input.y]], [$2])
AT_BISON_CHECK([-o input.c input.y])
AT_SYNCLINES_COMPILE([input.c])
-AT_CHECK([cat stdout], 0, [$3])
+# GCC 4.5 tells you the function within which #error appears, but
+# previous versions of gcc do not.
+AT_CHECK([grep -v ': In function ' stdout], 0, [$3])
AT_CLEANUP
])