]> granicus.if.org Git - graphviz/commitdiff
gml2gv: control Flex unistd.h suppression by whether we are on Windows
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 14 Apr 2022 00:37:36 +0000 (17:37 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 24 Apr 2022 15:52:41 +0000 (08:52 -0700)
This aligns more closely with the idiom used in lib/cgraph, and Windows is the
only non-unistd.h-having platform we support.

Gitlab: #2204

cmd/tools/CMakeLists.txt
cmd/tools/gml2gv.vcxproj
cmd/tools/gmlscan.l

index 7726e67afaf289fe321a20c5318c1477820fb1ab..4e04aade5c4f6c332b541566e4cc5e1f701d372b 100644 (file)
@@ -124,6 +124,10 @@ add_executable(gml2gv
   ${FLEX_Gmlscan_OUTPUTS}
 )
 
+if(WIN32 AND NOT MINGW)
+  target_compile_definitions(gml2gv PRIVATE -DYY_NO_UNISTD_H)
+endif()
+
 target_include_directories(gml2gv PRIVATE
   ../../lib
   ${CMAKE_CURRENT_SOURCE_DIR}
index 2128fc9d1d20c5f3f2531ebc1c07c7c7e1b69c6d..69326a94e92231c7d9f835b0b2ef33027e5ec073 100644 (file)
@@ -54,7 +54,7 @@
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>$(ProjectDir);$(SolutionDir)windows\include;$(SolutionDir)windows\dependencies\libraries\vcpkg\installed\x86-windows\include;$(SolutionDir);$(SolutionDir)lib;$(SolutionDir)lib\cdt;$(SolutionDir)lib\cgraph;$(SolutionDir)lib\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_DEBUG;_WINDOWS;GVDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>_DEBUG;_WINDOWS;GVDLL;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <PrecompiledHeader />
@@ -81,7 +81,7 @@ win_bison -dy -Wno-yacc gmlparse.y -o gmlparse.c</Command>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
       <AdditionalIncludeDirectories>$(ProjectDir);$(SolutionDir)windows\include;$(SolutionDir)windows\dependencies\libraries\vcpkg\installed\x86-windows\include;$(SolutionDir);$(SolutionDir)lib;$(SolutionDir)lib\cdt;$(SolutionDir)lib\cgraph;$(SolutionDir)lib\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>NDEBUG;_WINDOWS;GVDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>NDEBUG;_WINDOWS;GVDLL;YY_NO_UNISTD_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PrecompiledHeader />
       <WarningLevel>Level4</WarningLevel>
       <EnablePREfast>true</EnablePREfast>
index e149275d8323c4c30578486bc40fe7470d786492..4002a3ba769fd50aaffeff4d205cc7b3826b9995 100644 (file)
 #include <gmlparse.h>
 #include "config.h"
 
-#ifndef HAVE_UNISTD_H
-#define YY_NO_UNISTD_H
-#endif
-
 #define GRAPH_EOF_TOKEN     '@'     /* lex class must be defined below */
 
 static int line_num = 1;