Parcourir la source

[linux-port] Fix mising cast from const void* to void* in macro (#1496)

This causes problems on GCC 6. To compile the existing code,
-fpermissive is needed.

Copied the new implementation from newer version of LLVM.
Lei Zhang il y a 7 ans
Parent
commit
0459364bd8
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  1. 3 2
      lib/Support/DynamicLibrary.cpp

+ 3 - 2
lib/Support/DynamicLibrary.cpp

@@ -137,8 +137,9 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) {
     return Result;
     return Result;
 
 
 // This macro returns the address of a well-known, explicit symbol
 // This macro returns the address of a well-known, explicit symbol
-#define EXPLICIT_SYMBOL(SYM) \
-   if (!strcmp(symbolName, #SYM)) return &SYM
+#define EXPLICIT_SYMBOL(SYM)                                                   \
+  if (!strcmp(symbolName, #SYM))                                               \
+    return (void *)&SYM
 
 
 // On linux we have a weird situation. The stderr/out/in symbols are both
 // On linux we have a weird situation. The stderr/out/in symbols are both
 // macros and global variables because of standards requirements. So, we
 // macros and global variables because of standards requirements. So, we