Alexandre Julliard : makefiles: Use explicit header path for sanity checks.

Alexandre Julliard julliard at winehq.org
Thu Sep 23 15:35:04 CDT 2021


Module: wine
Branch: master
Commit: 8ec232132853ee9efae4c5bde9fce665d9846ca1
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=8ec232132853ee9efae4c5bde9fce665d9846ca1

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Sep 23 14:44:50 2021 +0200

makefiles: Use explicit header path for sanity checks.

This makes it possible to use a local config.h.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 tools/makedep.c | 38 +++++++++++++++-----------------------
 1 file changed, 15 insertions(+), 23 deletions(-)

diff --git a/tools/makedep.c b/tools/makedep.c
index 9110035d633..6e10e4d3be4 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -907,26 +907,6 @@ static struct file *add_file( const char *name )
  */
 static void add_dependency( struct file *file, const char *name, enum incl_type type )
 {
-    /* enforce some rules for the Wine tree */
-
-    if (!strcmp( name, "config.h" ))
-    {
-        if (strendswith( file->name, ".h" ))
-            fatal_error( "config.h must not be included by a header file\n" );
-        if (file->deps_count)
-            fatal_error( "config.h must be included before anything else\n" );
-    }
-    else if (!strcmp( name, "wine/port.h" ))
-    {
-        if (strendswith( file->name, ".h" ))
-            fatal_error( "wine/port.h must not be included by a header file\n" );
-        if (!file->deps_count) fatal_error( "config.h must be included before wine/port.h\n" );
-        if (file->deps_count > 1)
-            fatal_error( "wine/port.h must be included before everything except config.h\n" );
-        if (strcmp( file->deps[0].name, "config.h" ))
-            fatal_error( "config.h must be included before wine/port.h\n" );
-    }
-
     if (file->deps_count >= file->deps_size)
     {
         file->deps_size *= 2;
@@ -1630,9 +1610,6 @@ static void add_all_includes( struct makefile *make, struct incl_file *parent, s
 {
     unsigned int i;
 
-    parent->files_count = 0;
-    parent->files_size = file->deps_count;
-    parent->files = xmalloc( parent->files_size * sizeof(*parent->files) );
     for (i = 0; i < file->deps_count; i++)
     {
         switch (file->deps[i].type)
@@ -2094,7 +2071,22 @@ static void get_dependencies( struct incl_file *file, struct incl_file *source )
             return;  /* library is imported only when building a typelib */
         file->owner = source;
         strarray_add( &source->dependencies, file->filename );
+
+        /* sanity checks */
+        if ((!strcmp( file->filename, "include/config.h" ) && file != source->files[0]) ||
+            (!strcmp( file->filename, "include/wine/port.h" ) && file != source->files[1]))
+        {
+            input_file_name = source->filename;
+            input_line = 0;
+            for (i = 0; i < source->file->deps_count; i++)
+            {
+                if (!strcmp( source->file->deps[i].name, file->name ))
+                    input_line = source->file->deps[i].line;
+            }
+            fatal_error( "%s must be included before other headers\n", file->name );
+        }
     }
+
     for (i = 0; i < file->files_count; i++) get_dependencies( file->files[i], source );
 }
 




More information about the wine-cvs mailing list