libfirm / cparser

C99 parser and frontend for libfirm
http://pp.ipd.kit.edu/firm
GNU General Public License v2.0
336 stars 38 forks source link

pointer truncation when compiling latest cparser on musl based x86_64 linux #18

Closed rofl0r closed 5 years ago

rofl0r commented 5 years ago
./src/main.c: In function 'main':
./src/main.c:323:25: warning: implicit declaration of function 'strndup' [-Wimplicit-function-declaration]
    char *const triple = strndup(name, dash - name);
                         ^~~~~~~
./src/main.c:323:25: warning: initialization makes pointer from integer without a cast [-Wint-conversion]

following patch fixes it

diff --git a/src/main.c b/src/main.c
index e1526d87..dc6ba84b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2,6 +2,7 @@
  * This file is part of cparser.
  * Copyright (C) 2012 Matthias Braun <matze@braunis.de>
  */
+#define _GNU_SOURCE
 #include <errno.h>
 #include <stdbool.h>
 #include <stdio.h>