summaryrefslogtreecommitdiff
path: root/libarchive_fe
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@gmail.com>2009-11-01 01:56:20 -0500
committerTim Kientzle <kientzle@gmail.com>2009-11-01 01:56:20 -0500
commit5eec93b79577eccd20370bc440cad21f7592866c (patch)
tree8de6d5af2432f37276ff5afc0529ab898b050d8d /libarchive_fe
parent514e4f186bbd9553f08c9f0611d0fbd2f54c1014 (diff)
downloadlibarchive-5eec93b79577eccd20370bc440cad21f7592866c.tar.gz
Make the __FBSDID() handling more platform-agnostic by using
HAVE_SYS_CDEFS_H to control the inclusion of sys/cdefs.h and defining a fake __FBSDID() macro if we need one. In particular, this deals a lot more gracefully with systems that are not FreeBSD but use FreeBSD-derived system headers. See Issue 46 on libarchive.googlecode.com for discussion. Submitted by: cpr420 SVN-Revision: 1565
Diffstat (limited to 'libarchive_fe')
-rw-r--r--libarchive_fe/lafe_platform.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/libarchive_fe/lafe_platform.h b/libarchive_fe/lafe_platform.h
index dceb5aaf..557124b9 100644
--- a/libarchive_fe/lafe_platform.h
+++ b/libarchive_fe/lafe_platform.h
@@ -42,11 +42,13 @@
#include "config.h"
#endif
-/* No non-FreeBSD platform will have __FBSDID, so just define it here. */
-#ifdef __FreeBSD__
-#include <sys/cdefs.h> /* For __FBSDID */
-#elif !defined(__FBSDID)
-/* Just leaving this macro replacement empty leads to a dangling semicolon. */
+/* Get a real definition for __FBSDID if we can */
+#if HAVE_SYS_CDEFS_H
+#include <sys/cdefs.h>
+#endif
+
+/* If not, define it so as to avoid dangling semicolons. */
+#ifndef __FBSDID
#define __FBSDID(a) struct _undefined_hack
#endif