Skip to content

Commit 598c566

Browse files
author
Kevin Pyle
committed
Build: find c-pragma.h,c-common.h regardless of gcc version
Add an extra -I line for the non-flattened location, then change all inclusions to rely on the preprocessor search path to find the file. It is legal to specify a non-existent directory in the search path, so this will work with both old and new layouts.
1 parent 99da8c8 commit 598c566

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ PYTHON_CONFIG=python-config
9797
PYTHON_INCLUDES=$(shell $(PYTHON_CONFIG) --includes)
9898
PYTHON_LIBS=$(shell $(PYTHON_CONFIG) --libs)
9999

100-
CPPFLAGS+= -I$(GCCPLUGINS_DIR)/include -I. $(PYTHON_INCLUDES)
100+
CPPFLAGS+= -I$(GCCPLUGINS_DIR)/include -I$(GCCPLUGINS_DIR)/include/c-family -I. $(PYTHON_INCLUDES)
101101
# Allow user to pick optimization, choose whether warnings are fatal,
102102
# and choose debugging information level.
103103
CFLAGS?=-O2 -Werror -g

gcc-python-option.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <Python.h>
2121
#include "gcc-python.h"
2222
#include "gcc-python-wrappers.h"
23-
#include "c-family/c-common.h" /* for warn_format */
23+
#include "c-common.h" /* for warn_format */
2424
#include "diagnostic.h"
2525

2626

gcc-python.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ int plugin_is_GPL_compatible;
3434
#include "cgraph.h"
3535
#include "opts.h"
3636

37-
#include "c-family/c-pragma.h" /* for parse_in */
37+
/*
38+
* Use an unqualified name here and rely on dual search paths to let the
39+
* compiler find it. This deals with c-pragma.h moving to a
40+
* subdirectory in newer versions of gcc.
41+
*/
42+
#include "c-pragma.h" /* for parse_in */
3843

3944
#if 0
4045
#define LOG(msg) \

0 commit comments

Comments
 (0)