gcc-isms #16

Closed
asl opened this Issue Oct 13, 2012 · 4 comments

Comments

Projects
None yet
3 participants
Contributor

asl commented Oct 13, 2012

folly contains a decent amount of gcc'isms. Let me enumerate some of them:

  1. Portability.h uses __GNUC_PREREQ macro, which is basically available only on gcc and only after features.h is included.
  2. Several headers include stuff from bits/* which is definitely no-go, since it contains libstdc++ internal stuff and might now be available on, e.g. libc++-only system
Contributor

tudor commented Oct 13, 2012

Yes it does. Making folly portable outside of gcc 4.6+, Linux x86_64 has never been an explicit goal. We would welcome patches, though :)

Contributor

asl commented Oct 13, 2012

Fix for Portability.h is simple:

diff --git a/folly/Portability.h b/folly/Portability.h
index 6d373a2..a9e8d32 100644
--- a/folly/Portability.h
+++ b/folly/Portability.h
@@ -33,7 +33,11 @@
 #undef FOLLY_FINAL
 #undef FOLLY_OVERRIDE

-#ifdef __GNUC__
+#if defined(__clang__)
+#  define FOLLY_FINAL final
+#  define FOLLY_OVERRIDE override
+#elif defined(__GNUC__)
+# include <features.h>
 # if __GNUC_PREREQ(4,7)
 #  define FOLLY_FINAL final
 #  define FOLLY_OVERRIDE override
Contributor

asl commented Oct 13, 2012

(sorry, no pull request, I have heavily hacked tree around)

Contributor

asl commented Oct 13, 2012

But will provide some fixes soon :)

@jdelong jdelong closed this Apr 13, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment