Go via uintptr_t when casting away constness, otherwise GCC will warn
when using -Wcast-qual.
llvm-svn: 209214
diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c
index 779a682..2f77e31 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -8,10 +8,13 @@
\*===----------------------------------------------------------------------===*/
#include "InstrProfiling.h"
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#define UNCONST(ptr) ((void *)(uintptr_t)(ptr))
+
static int writeFile(FILE *File) {
/* Match logic in __llvm_profile_write_buffer(). */
const __llvm_profile_data *DataBegin = __llvm_profile_data_begin();
@@ -75,7 +78,7 @@
static void setFilename(const char *Filename, int OwnsFilename) {
if (__llvm_profile_OwnsFilename)
- free((char *)__llvm_profile_CurrentFilename);
+ free(UNCONST(__llvm_profile_CurrentFilename));
__llvm_profile_CurrentFilename = Filename;
__llvm_profile_OwnsFilename = OwnsFilename;