summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@bec.de>2014-05-20 16:37:07 +0000
committerJoerg Sonnenberger <joerg@bec.de>2014-05-20 16:37:07 +0000
commitb1cc6d5603f68ab9bf62210078fb143404b71870 (patch)
tree180e11dfb3f93a271c1cde4e6127148de8e82e32
parent2e62f7220f9d96f72332a49ff1e3ee71616809c9 (diff)
downloadbcm5719-llvm-b1cc6d5603f68ab9bf62210078fb143404b71870.tar.gz
bcm5719-llvm-b1cc6d5603f68ab9bf62210078fb143404b71870.zip
Go via uintptr_t when casting away constness, otherwise GCC will warn
when using -Wcast-qual. llvm-svn: 209214
-rw-r--r--compiler-rt/lib/profile/InstrProfilingFile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c
index 779a68225c3..2f77e316e27 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 @@ __attribute__((weak)) const char *__llvm_profile_CurrentFilename = NULL;
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;
OpenPOWER on IntegriCloud