Better test for availability of __gnu_cxx::stdio_filebuf.
authorGordon Henriksen <gordonhenriksen@mac.com>
Wed, 11 Jun 2008 10:46:24 +0000 (10:46 +0000)
committerGordon Henriksen <gordonhenriksen@mac.com>
Wed, 11 Jun 2008 10:46:24 +0000 (10:46 +0000)
If this doesn't work, I'll write a configure test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52213 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bitcode/Writer/BitWriter.cpp

index 1aac5006d8f6ced4fad72f5487ccba690535cc9a..8834964b040ce778d7ae6a2e9775d529c6bfbfd3 100644 (file)
@@ -28,7 +28,7 @@ int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path) {
   return 0;
 }
 
-#ifdef __GNUC__
+#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR >= 4)
 #include <ext/stdio_filebuf.h>
 
 // FIXME: Control this with configure? Provide some portable abstraction in
@@ -49,4 +49,10 @@ int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int FileHandle) {
   return 0;
 }
 
+#else
+
+int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int FileHandle) {
+  return -1; // Not supported.
+}
+
 #endif