]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Rewrite local headers check to be more robust and informative.
authorRoland McGrath <roland@hack.frob.com>
Sat, 2 Jul 2011 22:52:51 +0000 (15:52 -0700)
committerRoland McGrath <roland@hack.frob.com>
Sat, 2 Jul 2011 22:52:51 +0000 (15:52 -0700)
ChangeLog
Makefile
scripts/check-local-headers.sh

index 2ef1710c3c116e87237c49e407daff0f79da8a21..70c31cb745ae975c1f48df68bbff97d53a8e8805 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2011-07-02  Roland McGrath  <roland@hack.frob.com>
 
+       * scripts/check-local-headers.sh: Rewritten using awk.
+       Match by word, not by line.  Print error messages for matches.
+       * Makefile ($(objpfx)check-local-headers.out): Pass AWK in to it.
+
        * Makerules [shlib-lds-flags empty]:
        ($(common-objpfx)libc_pic.opts): New target.
        ($(common-objpfx)libc_pic.os.clean): New target.
index aac255713d9b30c3b1ef70202d149c21c8d83bef..287f671c17748a13c548b4c56afe9b0d4ba7bd09 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -284,7 +284,8 @@ endif
 endif
 
 $(objpfx)check-local-headers.out: scripts/check-local-headers.sh
-       scripts/check-local-headers.sh "$(includedir)" "$(objpfx)" > $@
+       AWK='$(AWK)' scripts/check-local-headers.sh \
+         "$(includedir)" "$(objpfx)" > $@
 
 ifneq ($(PERL),no)
 installed-headers = argp/argp.h assert/assert.h catgets/nl_types.h \
index d15e9a44164ce66037b7355dc4d19890246263b4..b73078d364cf122a8c279dad6edfa16e55cfa4c2 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/bash
-# Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2005,2007,2009,2011 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -23,18 +23,21 @@ objpfx="$2"
 # To avoid long paths.
 cd "$objpfx"
 
-
 # Search all dependency files for file names in the include directory.
 # There are a few system headers we are known to use.
-if fgrep "$includedir" */*.{o,os,oS}.d |
-fgrep -v "$includedir/asm" |
-fgrep -v "$includedir/linux" |
-fgrep -v "$includedir/selinux" |
-fgrep -v "$includedir/sys/capability.h" |
-fgrep -v "$includedir/gd" |
-fgrep -v "$includedir/nss3"; then
-  # If we found a match something is wrong.
-  exit 1
-fi
-
-exit 0
+exec ${AWK} -v includedir="$includedir" '
+BEGIN {
+  status = 0
+  exclude = "^" includedir \
+    "/(asm[-/]|linux/|selinux/|gd|nss3/|sys/capability\\.h)"
+}
+/^[^ ]/ && $1 ~ /.*:/ { obj = $1 }
+{
+  for (i = 1; i <= NF; ++i) {
+    if ($i ~ ("^" includedir) && $i !~ exclude) {
+      print "***", obj, "uses", $i
+      status = 1
+    }
+  }
+}
+END { exit status }' */*.{o,os,oS}.d