From a1be6b475d96763bfb6c99e0525d98b061213b02 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 18 Oct 2021 11:07:02 +0200 Subject: [PATCH] makefiles: Don't pass warning flags to external libraries. Signed-off-by: Alexandre Julliard --- tools/makedep.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tools/makedep.c b/tools/makedep.c index 88a43c39741..a7a7924a20b 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -128,6 +128,8 @@ static struct strarray target_flags; static struct strarray msvcrt_flags; static struct strarray extra_cflags; static struct strarray extra_cross_cflags; +static struct strarray extra_cflags_extlib; +static struct strarray extra_cross_cflags_extlib; static struct strarray cpp_flags; static struct strarray lddll_flags; static struct strarray libs; @@ -2270,6 +2272,21 @@ static struct strarray get_source_defines( struct makefile *make, struct incl_fi /******************************************************************* + * remove_warning_flags + */ +static struct strarray remove_warning_flags( struct strarray flags ) +{ + unsigned int i; + struct strarray ret = empty_strarray; + + for (i = 0; i < flags.count; i++) + if (strncmp( flags.str[i], "-W", 2 ) || !strncmp( flags.str[i], "-Wno-", 5 )) + strarray_add( &ret, flags.str[i] ); + return ret; +} + + +/******************************************************************* * get_debug_file */ static const char *get_debug_file( struct makefile *make, const char *name ) @@ -3010,7 +3027,7 @@ static void output_source_default( struct makefile *make, struct incl_file *sour if (!*dll_ext && make->module && is_crt_module( make->module )) output_filename( "-fno-builtin" ); } - output_filenames( extra_cflags ); + output_filenames( make->extlib ? extra_cflags_extlib : extra_cflags ); output_filenames( cpp_flags ); output_filename( "$(CFLAGS)" ); output( "\n" ); @@ -3024,7 +3041,7 @@ static void output_source_default( struct makefile *make, struct incl_file *sour output( "%s.cross.o: %s\n", obj_dir_path( make, obj ), source->filename ); output( "\t%s$(CROSSCC) -c -o $@ %s", cmd_prefix( "CC" ), source->filename ); output_filenames( defines ); - output_filenames( extra_cross_cflags ); + output_filenames( make->extlib ? extra_cross_cflags_extlib : extra_cross_cflags ); if (make->module && is_crt_module( make->module )) output_filename( "-fno-builtin" ); output_filenames( cpp_flags ); @@ -4311,6 +4328,9 @@ int main( int argc, char *argv[] ) else so_dir = pe_dir = "$(dlldir)"; + extra_cflags_extlib = remove_warning_flags( extra_cflags ); + extra_cross_cflags_extlib = remove_warning_flags( extra_cross_cflags ); + top_makefile->src_dir = root_src_dir; subdirs = get_expanded_make_var_array( top_makefile, "SUBDIRS" ); disabled_dirs = get_expanded_make_var_array( top_makefile, "DISABLED_SUBDIRS" ); -- 2.11.4.GIT