Summary:
When compiling folly with clang, the compiler warns about our
use of GCC-specific pragmas to silence incorrect compiler warnings:
folly/Optional.h:79:33: warning: unknown warning group '-Wpragmas', ignored [-Wunknown-pragmas]
folly/Optional.h:80:33: warning: unknown warning group '-Wmaybe-uninitialized', ignored [-Wunknown-pragmas]
Thankfully, those incorrect compiler warnings are not emitted by
clang, so we can just disable the pragmas in clang.
Test Plan:
Built folly in gcc and ran it through clang. Warning above
is gone.
Reviewed By: andrei.alexandrescu@fb.com
FB internal diff:
D733323
* gcc-4.7 throws what appears to be some false positive uninitialized
* warnings for the members of the MediumLarge struct. So, mute them here.
*/
+#if defined(__GNUC__) && !defined(__clang__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wuninitialized"
+#endif
/**
* This is the core of the string. The code should work on 32- and
}
};
+#if defined(__GNUC__) && !defined(__clang__)
# pragma GCC diagnostic pop
+#endif
#ifndef _LIBSTDCXX_FBSTRING
/**
* gcc-4.7 warns about use of uninitialized memory around the use of storage_
* even though this is explicitly initialized at each point.
*/
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__clang__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wuninitialized"
# pragma GCC diagnostic ignored "-Wpragmas"
bool hasValue_;
};
+#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
+#endif
template<class T>
const T* get_pointer(const Optional<T>& opt) {