From: Shawn Routhier Date: Thu, 16 Feb 2012 22:07:04 +0000 (+0000) Subject: Add a compile time check for the presence of the noreturn attribute X-Git-Tag: v4_3_0a1~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3c948003ba79f75f9bd7ae0efb5488664f44475;p=thirdparty%2Fdhcp.git Add a compile time check for the presence of the noreturn attribute and use it for log_fatal if it's available. This will help code checking programs to eliminate false positives. [ISC-Bugs 27539] --- diff --git a/RELNOTES b/RELNOTES index 0fe9b7569..e0e7d604d 100644 --- a/RELNOTES +++ b/RELNOTES @@ -89,6 +89,11 @@ work on other platforms. Please report any problems and suggested fixes to support for Infiniband in the future. This patch also corrects some issues we found in the socket code. [ISC-Bugs #24245] +- Add a compile time check for the presence of the noreturn attribute + and use it for log_fatal if it's available. This will help code + checking programs to eliminate false positives. + [ISC-Bugs 27539] + Changes since 4.2.2 - Fix the code that checks for an existing DDNS transaction to cancel diff --git a/configure.ac b/configure.ac index 475aefb7f..8ebedac5e 100644 --- a/configure.ac +++ b/configure.ac @@ -453,6 +453,18 @@ AC_TRY_LINK( [Define to 1 if the system has 'struct if_laddrreq'.])], [AC_MSG_RESULT(no)]) +# +# check for GCC noreturn attribute +# +AC_MSG_CHECKING(for GCC noreturn attribute) +AC_TRY_COMPILE([],[void foo() __attribute__((noreturn));], + [AC_MSG_RESULT(yes) + AC_DEFINE([ISC_DHCP_NORETURN], [__attribute__((noreturn))], + [Define to the string for a noreturn attribute.])], + [AC_MSG_RESULT(no) + AC_DEFINE([ISC_DHCP_NORETURN], [], + [Define to the string for a noreturn attribute.])]) + # Look for optional headers. AC_CHECK_HEADERS(sys/socket.h net/if_dl.h net/if6.h regex.h) @@ -488,7 +500,7 @@ AC_CHECK_SIZEOF(struct iaddr *, , [ #include ]) -# Solaris does not have the msg_control or msg_controlen members in +# Solaris does not have the msg_control or msg_controlen members # in the msghdr structure unless you define: # # _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED, and __EXTENSIONS__ diff --git a/includes/omapip/omapip_p.h b/includes/omapip/omapip_p.h index 8671d4896..847f764c2 100644 --- a/includes/omapip/omapip_p.h +++ b/includes/omapip/omapip_p.h @@ -289,7 +289,7 @@ extern int log_perror; extern void (*log_cleanup) (void); void log_fatal (const char *, ...) - __attribute__((__format__(__printf__,1,2))); + __attribute__((__format__(__printf__,1,2))) ISC_DHCP_NORETURN; int log_error (const char *, ...) __attribute__((__format__(__printf__,1,2))); int log_info (const char *, ...)