From c2a5e7d0d0d782a6a6c9d74ba8d55c7abc9fa597 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 22 Aug 2020 16:01:54 -0700 Subject: [PATCH] disambiguate lib/vmalloc/*.c #includes Related to #1785. --- lib/vmalloc/CMakeLists.txt | 7 +++++-- lib/vmalloc/Makefile.am | 2 ++ lib/vmalloc/test.c | 14 +++++++------- lib/vmalloc/vmalloc.vcxproj | 4 ++-- lib/vmalloc/vmbest.c | 4 ++-- lib/vmalloc/vmclear.c | 4 ++-- lib/vmalloc/vmclose.c | 4 ++-- lib/vmalloc/vmopen.c | 4 ++-- lib/vmalloc/vmstrdup.c | 2 +- rtest/test_vmalloc.py | 7 +++++-- 10 files changed, 30 insertions(+), 22 deletions(-) diff --git a/lib/vmalloc/CMakeLists.txt b/lib/vmalloc/CMakeLists.txt index 9bdd5087e..2bf9a5b92 100644 --- a/lib/vmalloc/CMakeLists.txt +++ b/lib/vmalloc/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - add_library(vmalloc STATIC # Header files vmalloc.h @@ -12,3 +10,8 @@ add_library(vmalloc STATIC vmopen.c vmstrdup.c ) + +target_include_directories(vmalloc PRIVATE + ${GRAPHVIZ_LIB_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} +) diff --git a/lib/vmalloc/Makefile.am b/lib/vmalloc/Makefile.am index 3f210cf25..4e73b3e4c 100644 --- a/lib/vmalloc/Makefile.am +++ b/lib/vmalloc/Makefile.am @@ -1,6 +1,8 @@ # $Id$ $Revision$ ## Process this file with automake to produce Makefile.in +AM_CPPFLAGS = -I$(top_srcdir)/lib + noinst_HEADERS = vmalloc.h vmhdr.h noinst_LTLIBRARIES = libvmalloc_C.la diff --git a/lib/vmalloc/test.c b/lib/vmalloc/test.c index 43a92b686..a8e2bb9cc 100644 --- a/lib/vmalloc/test.c +++ b/lib/vmalloc/test.c @@ -11,13 +11,13 @@ #include /* include vmalloc and some of its internals directly so we can call them */ -#include "vmhdr.h" -#include "vmalloc.h" -#include "vmbest.c" -#include "vmclear.c" -#include "vmclose.c" -#include "vmopen.c" -#include "vmstrdup.c" +#include +#include +#include +#include +#include +#include +#include /* trivial lifecycle of a vmalloc */ static void test_basic_lifecycle(void) { diff --git a/lib/vmalloc/vmalloc.vcxproj b/lib/vmalloc/vmalloc.vcxproj index 9df5a9229..60c41cbb0 100644 --- a/lib/vmalloc/vmalloc.vcxproj +++ b/lib/vmalloc/vmalloc.vcxproj @@ -51,7 +51,7 @@ Disabled - $(SolutionDir)windows\include;%(AdditionalIncludeDirectories) + $(SolutionDir)windows\include;$(SolutionDir)\lib;%(AdditionalIncludeDirectories) _DEBUG;_WINDOWS;%(PreprocessorDefinitions) true EnableFastChecks @@ -75,7 +75,7 @@ - $(SolutionDir)windows\include;%(AdditionalIncludeDirectories) + $(SolutionDir)windows\include;$(SolutionDir)\lib;%(AdditionalIncludeDirectories) NDEBUG;_WINDOWS;%(PreprocessorDefinitions) false diff --git a/lib/vmalloc/vmbest.c b/lib/vmalloc/vmbest.c index 0f0f7ea25..7c8481378 100644 --- a/lib/vmalloc/vmbest.c +++ b/lib/vmalloc/vmbest.c @@ -8,8 +8,8 @@ * Contributors: See CVS logs. Details at http://www.graphviz.org/ *************************************************************************/ -#include "vmhdr.h" -#include "vmalloc.h" +#include +#include #include #include #include diff --git a/lib/vmalloc/vmclear.c b/lib/vmalloc/vmclear.c index 44a31e650..9bb8716b5 100644 --- a/lib/vmalloc/vmclear.c +++ b/lib/vmalloc/vmclear.c @@ -8,8 +8,8 @@ * Contributors: See CVS logs. Details at http://www.graphviz.org/ *************************************************************************/ -#include "vmhdr.h" -#include "vmalloc.h" +#include +#include #include /** Clear out all allocated space. diff --git a/lib/vmalloc/vmclose.c b/lib/vmalloc/vmclose.c index abcc4f9a8..a165b6a40 100644 --- a/lib/vmalloc/vmclose.c +++ b/lib/vmalloc/vmclose.c @@ -8,8 +8,8 @@ * Contributors: See CVS logs. Details at http://www.graphviz.org/ *************************************************************************/ -#include "vmhdr.h" -#include "vmalloc.h" +#include +#include #include /** Close down a region. diff --git a/lib/vmalloc/vmopen.c b/lib/vmalloc/vmopen.c index 8e185c876..04d8f78e8 100644 --- a/lib/vmalloc/vmopen.c +++ b/lib/vmalloc/vmopen.c @@ -8,8 +8,8 @@ * Contributors: See CVS logs. Details at http://www.graphviz.org/ *************************************************************************/ -#include "vmhdr.h" -#include "vmalloc.h" +#include +#include #include /** Open a new region of allocation. diff --git a/lib/vmalloc/vmstrdup.c b/lib/vmalloc/vmstrdup.c index 535635226..d86478b6f 100644 --- a/lib/vmalloc/vmstrdup.c +++ b/lib/vmalloc/vmstrdup.c @@ -13,7 +13,7 @@ #include -#include "vmhdr.h" +#include /* * return a copy of s using vmalloc */ diff --git a/rtest/test_vmalloc.py b/rtest/test_vmalloc.py index 98e4041eb..61ca0cfd5 100644 --- a/rtest/test_vmalloc.py +++ b/rtest/test_vmalloc.py @@ -13,16 +13,19 @@ def test_vmalloc(): '../lib/vmalloc/test.c') assert os.path.exists(src) + # locate lib directory that needs to be in the include path + lib = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../lib') + # create a temporary directory to work in with tempfile.TemporaryDirectory() as tmp: # compile the unit tests dst = os.path.join(tmp, 'vmalloc-tests.exe') if platform.system() == 'Windows': - subprocess.check_call(['cl', '-nologo', src, '-Fe:', dst]) + subprocess.check_call(['cl', '-I', lib, '-nologo', src, '-Fe:', dst]) else: subprocess.check_call([os.environ.get('CC', 'cc'), '-Wall', '-Wextra', - '-Werror', '-o', dst, src]) + '-Werror', '-I', lib, '-o', dst, src]) # run the unit tests subprocess.check_call([dst]) -- 2.40.0