Fix build with GCC6 47/110347/1 accepted/tizen/common/20170116.181608 accepted/tizen/ivi/20170116.090507 accepted/tizen/mobile/20170116.090411 accepted/tizen/tv/20170116.090432 accepted/tizen/unified/20170309.040212 accepted/tizen/wearable/20170116.090452 submit/tizen/20170116.062507 submit/tizen_unified/20170308.100415
authorSeungbae Shin <seungbae.shin@samsung.com>
Wed, 11 Jan 2017 15:23:30 +0000 (00:23 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Mon, 16 Jan 2017 04:51:36 +0000 (13:51 +0900)
Add -P option to GCC preprocessor
Distinguish linemarkers and pragmas (both start with #)

Change-Id: I54e8674a5bcbc087da6a40c0571e9c3e4de3ef7f

utils/collect-symbols.c

index 9b7b782035a20a0ee883630a0d002cea42fafd29..d4abaffbc8bdc631fe621f62aa0d25708a8fbcb1 100644 (file)
@@ -292,9 +292,9 @@ static int preprocess_file(const char *preproc, const char *file,
         argv[argc++] = "-c";
 
         if (cflags != NULL)
-            snprintf(cmd, sizeof(cmd), "%s %s -E %s", preproc, cflags, file);
+            snprintf(cmd, sizeof(cmd), "%s %s -E -P %s", preproc, cflags, file);
         else
-            snprintf(cmd, sizeof(cmd), "%s -E %s", preproc, file);
+            snprintf(cmd, sizeof(cmd), "%s -E -P %s", preproc, file);
 
         argv[argc++] = cmd;
         argv[argc]   = NULL;
@@ -627,6 +627,11 @@ static int collect_tokens(input_t *in, ringbuf_t *rb, token_t *tokens,
 
             /* extract path name from preprocessor line-markers */
         case '#':
+            if (input_read(in) == 'p') {    /* p for pragma */
+                while((ch = input_read(in)) != '\n' && ch) {}
+                break;
+            }
+            /* not pragma, assume linemarker */
             v = input_parse_linemarker(in, path, sizeof(path));
             if (v != NULL) {
                 tokens[n].type  = TOKEN_LINEMARKER;