[compiler-rt] r209214 - Go via uintptr_t when casting away constness, otherwise GCC will warn
Joerg Sonnenberger
joerg at bec.de
Tue May 20 09:37:08 PDT 2014
Author: joerg
Date: Tue May 20 11:37:07 2014
New Revision: 209214
URL: http://llvm.org/viewvc/llvm-project?rev=209214&view=rev
Log:
Go via uintptr_t when casting away constness, otherwise GCC will warn
when using -Wcast-qual.
Modified:
compiler-rt/trunk/lib/profile/InstrProfilingFile.c
Modified: compiler-rt/trunk/lib/profile/InstrProfilingFile.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingFile.c?rev=209214&r1=209213&r2=209214&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingFile.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingFile.c Tue May 20 11:37:07 2014
@@ -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
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;
More information about the llvm-commits
mailing list