]> granicus.if.org Git - graphviz/commitdiff
disambiguate lib/vmalloc/*.c #includes
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 22 Aug 2020 23:01:54 +0000 (16:01 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 10 Sep 2020 02:26:52 +0000 (19:26 -0700)
Related to #1785.

lib/vmalloc/CMakeLists.txt
lib/vmalloc/Makefile.am
lib/vmalloc/test.c
lib/vmalloc/vmalloc.vcxproj
lib/vmalloc/vmbest.c
lib/vmalloc/vmclear.c
lib/vmalloc/vmclose.c
lib/vmalloc/vmopen.c
lib/vmalloc/vmstrdup.c
rtest/test_vmalloc.py

index 9bdd5087e5efe60bf8fe72d89fb41ac6edc5bcaa..2bf9a5b925dba2fef179bf965223972ba03a57c2 100644 (file)
@@ -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}
+)
index 3f210cf25ec7ea5bf24dfab4f3e97e51f62d29d3..4e73b3e4c90ffa957d19d20758c18c581128ec02 100644 (file)
@@ -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
 
index 43a92b68643a84ace8496105e0747a23a1c7a1a4..a8e2bb9ccdf75ccd4b463cc1f2f5bdd9bcfbbd2b 100644 (file)
 #include <string.h>
 
 /* 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 <vmalloc/vmhdr.h>
+#include <vmalloc/vmalloc.h>
+#include <vmalloc/vmbest.c>
+#include <vmalloc/vmclear.c>
+#include <vmalloc/vmclose.c>
+#include <vmalloc/vmopen.c>
+#include <vmalloc/vmstrdup.c>
 
 /* trivial lifecycle of a vmalloc */
 static void test_basic_lifecycle(void) {
index 9df5a9229ae0fe334df41784c2fa149d04c981d7..60c41cbb0901442ef087ff105026a3f9bc243708 100644 (file)
@@ -51,7 +51,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(SolutionDir)windows\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(SolutionDir)windows\include;$(SolutionDir)\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -75,7 +75,7 @@
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
-      <AdditionalIncludeDirectories>$(SolutionDir)windows\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(SolutionDir)windows\include;$(SolutionDir)\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <IgnoreStandardIncludePath>false</IgnoreStandardIncludePath>
       <PrecompiledHeader />
index 0f0f7ea2502ae26262638497e931c86f60623b5d..7c8481378772746d7e4072c100d6bd641d0a35c3 100644 (file)
@@ -8,8 +8,8 @@
  * Contributors: See CVS logs. Details at http://www.graphviz.org/
  *************************************************************************/
 
-#include "vmhdr.h"
-#include "vmalloc.h"
+#include <vmalloc/vmhdr.h>
+#include <vmalloc/vmalloc.h>
 #include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
index 44a31e65044a10902b49447ecd7c85412a81ae1d..9bb8716b5759752b6474fae6a6f9395c9ff70c81 100644 (file)
@@ -8,8 +8,8 @@
  * Contributors: See CVS logs. Details at http://www.graphviz.org/
  *************************************************************************/
 
-#include "vmhdr.h"
-#include "vmalloc.h"
+#include <vmalloc/vmhdr.h>
+#include <vmalloc/vmalloc.h>
 #include <stdlib.h>
 
 /** Clear out all allocated space.
index abcc4f9a801ac894d13ad42206bcf62c961f2e99..a165b6a408b014d69c2bfb54b01ebcbd76ffba32 100644 (file)
@@ -8,8 +8,8 @@
  * Contributors: See CVS logs. Details at http://www.graphviz.org/
  *************************************************************************/
 
-#include "vmhdr.h"
-#include "vmalloc.h"
+#include <vmalloc/vmhdr.h>
+#include <vmalloc/vmalloc.h>
 #include <stdlib.h>
 
 /** Close down a region.
index 8e185c876464da63a4a3a874e62e5e3c66efb12e..04d8f78e8dd0e2a82a05301002972a8f78d1339a 100644 (file)
@@ -8,8 +8,8 @@
  * Contributors: See CVS logs. Details at http://www.graphviz.org/
  *************************************************************************/
 
-#include "vmhdr.h"
-#include "vmalloc.h"
+#include <vmalloc/vmhdr.h>
+#include <vmalloc/vmalloc.h>
 #include <stdlib.h>
 
 /** Open a new region of allocation.
index 5356352266bdb1787f6bfdb4d46847fe3c717b65..d86478b6f9993b8c9ae924e8b06b821ef8c8f6a9 100644 (file)
@@ -13,7 +13,7 @@
 
 
 #include <string.h>
-#include       "vmhdr.h"
+#include       <vmalloc/vmhdr.h>
 /*
  * return a copy of s using vmalloc
  */
index 98e4041ebbf4e5a0e38bc657dd20e6702b704743..61ca0cfd53735639896c7903d27cbabf3ce94484 100644 (file)
@@ -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])