Go via uintptr_t when casting away constness, otherwise GCC will warn

when using -Wcast-qual.

llvm-svn: 209214
This commit is contained in:
Joerg Sonnenberger 2014-05-20 16:37:07 +00:00
parent 2e62f7220f
commit b1cc6d5603

View File

@ -8,10 +8,13 @@
\*===----------------------------------------------------------------------===*/ \*===----------------------------------------------------------------------===*/
#include "InstrProfiling.h" #include "InstrProfiling.h"
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#define UNCONST(ptr) ((void *)(uintptr_t)(ptr))
static int writeFile(FILE *File) { static int writeFile(FILE *File) {
/* Match logic in __llvm_profile_write_buffer(). */ /* Match logic in __llvm_profile_write_buffer(). */
const __llvm_profile_data *DataBegin = __llvm_profile_data_begin(); const __llvm_profile_data *DataBegin = __llvm_profile_data_begin();
@ -75,7 +78,7 @@ __attribute__((weak)) const char *__llvm_profile_CurrentFilename = NULL;
static void setFilename(const char *Filename, int OwnsFilename) { static void setFilename(const char *Filename, int OwnsFilename) {
if (__llvm_profile_OwnsFilename) if (__llvm_profile_OwnsFilename)
free((char *)__llvm_profile_CurrentFilename); free(UNCONST(__llvm_profile_CurrentFilename));
__llvm_profile_CurrentFilename = Filename; __llvm_profile_CurrentFilename = Filename;
__llvm_profile_OwnsFilename = OwnsFilename; __llvm_profile_OwnsFilename = OwnsFilename;