The apparent intention of catching mistakes early is laudable. However, the number of exceptions both in the code and not in the code (in particular, valgrind.h) shows that this is clearly getting in the way more often than not.
In practice an attempt to compile with a system API we don't support will be met with a clear error at link time, e.g.:
/usr/bin/x86_64-w64-mingw32-ld: dlls/xmllite/reader.cross.o: in function `debugstr_nodetype': /home/whatsit/git/wine64/../wine/dlls/xmllite/reader.c:116: undefined reference to `pthread_once'
And when there is no external function involved (as with stdarg.h, x86intrin.h, valgrind.h), there's no reason to prevent use of the headers.
The motivation for this patch is the ability to import system vkd3d.h in e.g. d3d12 and dxgi, which do not link to libvkd3d directly (but rather indirectly through wined3d) and so do not fall under the has_external_import() exception. I could see no simple way to adapt has_external_import() to account for this case.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- Am I missing some other point of doing this? I'm fully willing to retract this patch if so, but I still don't see a good way to deal with the aforementioned problem.
tools/makedep.c | 27 --------------------------- 1 file changed, 27 deletions(-)
diff --git a/tools/makedep.c b/tools/makedep.c index 25277efd7bb..cc988e2aee7 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -1359,22 +1359,6 @@ static struct makefile *find_importlib_module( const char *name ) }
-/******************************************************************* - * has_external_import - */ -static int has_external_import( const struct makefile *make ) -{ - unsigned int i; - - for (i = 0; i < make->imports.count; i++) - { - if (!strncmp( make->imports.str[i], "-l", 2 )) - return 1; - } - return 0; -} - - /******************************************************************* * open_include_file */ @@ -1452,17 +1436,6 @@ static struct file *open_include_file( const struct makefile *make, struct incl_ return file; }
- if (pFile->type == INCL_SYSTEM && pFile->use_msvcrt && - !make->extlib && !pFile->included_by->is_external) - { - if (!strcmp( pFile->name, "stdarg.h" )) return NULL; - if (!strcmp( pFile->name, "x86intrin.h" )) return NULL; - if (has_external_import( make )) return NULL; - fprintf( stderr, "%s:%d: error: system header %s cannot be used with msvcrt\n", - pFile->included_by->file->name, pFile->included_line, pFile->name ); - exit(1); - } - if (pFile->type == INCL_SYSTEM) return NULL; /* ignore system files we cannot find */
/* try in src file directory */
Avoid depending on our modified copy of vkd3d.h to include Wine headers; this will not work with system vkd3d.h.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/d3d12/d3d12_main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d12/d3d12_main.c b/dlls/d3d12/d3d12_main.c index 1c2cea6a6f3..40e3165ee80 100644 --- a/dlls/d3d12/d3d12_main.c +++ b/dlls/d3d12/d3d12_main.c @@ -18,9 +18,15 @@ */
#define COBJMACROS +#define VKD3D_NO_VULKAN_H +#define VKD3D_NO_WIN32_TYPES + +#include "windef.h" +#include "dxgi1_6.h" +#include "d3d12.h" +#include "wine/vulkan.h"
#include <vkd3d.h> -#include "dxgi1_6.h"
#include "initguid.h" #include "wine/wined3d.h"
Avoid depending on our modified copy of vkd3d.h to include Wine headers; this will not work with system vkd3d.h.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/dxgi/swapchain.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c index aaf4fe101de..98b020217e4 100644 --- a/dlls/dxgi/swapchain.c +++ b/dlls/dxgi/swapchain.c @@ -18,6 +18,10 @@ */
#include "dxgi_private.h" + +#define VKD3D_NO_VULKAN_H +#define VKD3D_NO_WIN32_TYPES +#include "wine/vulkan.h" #include <vkd3d.h>
WINE_DEFAULT_DEBUG_CHANNEL(dxgi);
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- configure.ac | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/configure.ac b/configure.ac index a1f7a7d5e2c..ab3490b21cd 100644 --- a/configure.ac +++ b/configure.ac @@ -1084,6 +1084,27 @@ then WINE_NOTICE([libxslt ${notice_platform}MinGW development files not found; using bundled version.]) fi
+ WINE_MINGW_PACKAGE_FLAGS(VKD3D,[libvkd3d libvkd3d-shader],[-lvkd3d -lvkd3d-shader], + [WINE_CHECK_MINGW_HEADER(vkd3d.h) + WINE_CHECK_MINGW_HEADER(vkd3d_shader.h) + if test "$ac_cv_mingw_header_vkd3d_h" = "yes" -a "$ac_cv_mingw_header_vkd3d_shader_h" = "yes" + then + WINE_CHECK_MINGW_LIB(vkd3d,vkd3d_serialize_versioned_root_signature,[:],[:],[$VKD3D_PE_LIBS]) + WINE_CHECK_MINGW_LIB(vkd3d-shader,vkd3d_shader_compile,[:],[:],[$VKD3D_PE_LIBS]) + if test "$ac_cv_mingw_lib_vkd3d" = "no" -o "$ac_cv_mingw_lib_vkd3d_shader" = "no" + then + VKD3D_PE_CFLAGS="" + VKD3D_PE_LIBS="" + fi + else + VKD3D_PE_CFLAGS="" + VKD3D_PE_LIBS="" + fi]) + if test "x$VKD3D_PE_LIBS" = "x" + then + WINE_NOTICE([libvkd3d ${notice_platform}MinGW development files not found; using bundled version.]) + fi + WINE_MINGW_PACKAGE_FLAGS(ZLIB,[zlib],[-lz], [WINE_CHECK_MINGW_HEADER(zlib.h, [WINE_CHECK_MINGW_LIB(z,inflate,[:],[ZLIB_PE_CFLAGS=""; ZLIB_PE_LIBS=""],[$ZLIB_PE_LIBS])],