[libdispatch-changes] [45] trunk
source_changes at macosforge.org
source_changes at macosforge.org
Sat Sep 26 12:23:40 PDT 2009
Revision: 45
http://trac.macosforge.org/projects/libdispatch/changeset/45
Author: robert at fledge.watson.org
Date: 2009-09-26 12:23:40 -0700 (Sat, 26 Sep 2009)
Log Message:
-----------
Some versions of clang appear not to mark __builtin_trap() as __noreturn__,
leading to a compile error as dispatch_main(), which relies on
__builtin_trap() to exit in various error cases, is marked __no_return__.
Detect this bug/feature in configure, and handle.
Modified Paths:
--------------
trunk/configure.ac
trunk/src/queue.c
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2009-09-26 18:45:51 UTC (rev 44)
+++ trunk/configure.ac 2009-09-26 19:23:40 UTC (rev 45)
@@ -248,6 +248,15 @@
AC_SUBST([CBLOCKS_FLAGS])
#
+# Temporary: some versions of clang do not mark __builtin_trap() as
+# __attribute__((__noreturn__)). Detect and add if required.
+#
+AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([void __attribute__((__noreturn__)) temp(void) { __builtin_trap(); }], [])], [
+ AC_DEFINE(HAVE_NORETURN_BUILTIN_TRAP,,[Define if __builtin_trap marked noreturn])
+ ], [])
+
+#
# Generate Makefiles.
#
AC_CONFIG_FILES([Makefile dispatch/Makefile man/Makefile src/Makefile])
Modified: trunk/src/queue.c
===================================================================
--- trunk/src/queue.c 2009-09-26 18:45:51 UTC (rev 44)
+++ trunk/src/queue.c 2009-09-26 19:23:40 UTC (rev 45)
@@ -884,6 +884,15 @@
}
#endif
+/*
+ * XXXRW: Work-around for possible clang bug in which __builtin_trap() is not
+ * marked noreturn, leading to a build error as dispatch_main() *is* marked
+ * noreturn. Mask by marking __builtin_trap() as noreturn locally.
+ */
+#ifndef HAVE_NORETURN_BUILTIN_TRAP
+void __builtin_trap(void) __attribute__((__noreturn__));
+#endif
+
void
dispatch_main(void)
{
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/libdispatch-changes/attachments/20090926/6192b5ad/attachment-0001.html>
More information about the libdispatch-changes
mailing list