autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fix for ifnames and test for it


From: Pavel Roskin
Subject: Fix for ifnames and test for it
Date: Wed, 1 Nov 2000 19:57:07 -0500 (EST)

Hello!

The change in ifnames.sh entitled as "Adjust copyright notice" also
contained some formatting changes that break ifnames completely.

This patch reverts the changes between revisions 1.17 and 1.18 not related
to copyright notices and adds two tests for ifnames to the testsuite - one
of them with "gawk --posix", another one with the AWK that happens to be
chosen by autoconf.

ChangeLog:
        * ifnames.sh: Reverted formatting changes.
        * tests/tools.at (AWK portability): Check ifnames.
        (ifnames): New test for ifnames.

Regards,
Pavel Roskin

__________________________
Index: ifnames.sh
--- ifnames.sh  Wed Nov  1 14:30:56 2000
+++ ifnames.sh  Wed Nov  1 16:08:40 2000
@@ -72,20 +72,16 @@
 
 $AWK '
   # Record that sym was found in FILENAME.
-  function file_sym(sym,  i, fs)
-  {
-    if (sym ~ /^[A-Za-z_]/)
-    {
-      if (!found[sym,FILENAME])
-      {
+  function file_sym(sym,  i, fs) {
+    if (sym ~ /^[A-Za-z_]/) {
+      if (!found[sym,FILENAME]) {
        found[sym,FILENAME] = 1
 
        # Insert FILENAME into files[sym], keeping the list sorted.
        i = 1
        fs = files[sym]
        while (match(substr(fs, i), /^ [^ ]*/) \
-              && substr(fs, i + 1, RLENGTH - 1) < FILENAME)
-        {
+              && substr(fs, i + 1, RLENGTH - 1) < FILENAME) {
          i += RLENGTH
        }
        files[sym] = substr(fs, 1, i - 1) " " FILENAME substr(fs, i)
@@ -94,8 +90,7 @@
   }
 
   {
-    while (sub(/\\$/, "", $0) > 0)
-    {
+    while (sub(/\\$/, "", $0) > 0) {
       if ((getline tmp) > 0)
        $0 = $0 tmp
       else
@@ -103,32 +98,25 @@
     }
   }
 
-  /^[\t ]*#/
-  {
-    if (sub(/^[\t ]*#[\t ]*ifn?def[\t ]+/, "", $0))
-    {
+  /^[\t ]*#/ {
+    if (sub(/^[\t ]*#[\t ]*ifn?def[\t ]+/, "", $0)) {
       sub(/[^A-Za-z_0-9].*/, "", $0)
       file_sym($0)
     }
-    if (sub(/^[\t ]*#[\t ]*(el)?if[\t ]+/, "", $0))
-    {
+    if (sub(/^[\t ]*#[\t ]*(el)?if[\t ]+/, "", $0)) {
       # Remove comments.  Not perfect, but close enough.
       gsub(/\/\*[^\/]*(\*\/)?/, "", $0)
 
-      for (i = split($0, field, /[^A-Za-z_0-9]+/);  1 <= i;  i--)
-      {
-       if (field[i] != "defined")
-        {
+      for (i = split($0, field, /[^A-Za-z_0-9]+/);  1 <= i;  i--) {
+       if (field[i] != "defined") {
          file_sym(field[i])
        }
       }
     }
   }
 
-  END
-  {
-    for (sym in files)
-    {
+  END {
+    for (sym in files) {
       print sym files[sym]
     }
   }
Index: tests/tools.at
--- tests/tools.at      Wed Nov  1 10:24:16 2000
+++ tests/tools.at      Wed Nov  1 19:55:20 2000
@@ -340,6 +340,55 @@
   # Tracing.
   AT_CHECK([AWK='gawk --posix' autoconf --autoconf-dir .. -l $at_srcdir -t 
AC_INIT], 0,
            ignore, [])
+  # Syntax correctness of ifnames.
+  AT_CHECK([AWK='gawk --posix' ifnames empty], 0,
+           [], [])
 fi
+
+AT_CLEANUP(configure)
+
+
+
+
+
+## --------- ##
+## ifnames.  ##
+## --------- ##
+
+AT_SETUP(ifnames)
+
+AT_DATA([iftest1.c],
+[[#ifdef DEF1
+#ifndef DEF2
+#if !defined(DEF3) && defined(DEF4) /* but not defined(DEF5) */
+    # if SPACES
+       #       if      TABS
+/* #if C_COMMENTS */
+// #if CXX_COMMENTS
+#if LINE1 = \
+LINE2
+#if (VAL1*VAL2)==VAL3+VAL4 /* Not VAL5 !!! */
+]])
+
+AT_DATA([iftest2.c],
+[[#ifdef IFTEST2
+#if VAL1
+]])
+
+AT_CHECK([ifnames iftest1.c iftest2.c], 0,
+[DEF1 iftest1.c
+DEF2 iftest1.c
+DEF3 iftest1.c
+DEF4 iftest1.c
+IFTEST2 iftest2.c
+LINE1 iftest1.c
+LINE2 iftest1.c
+SPACES iftest1.c
+TABS iftest1.c
+VAL1 iftest1.c iftest2.c
+VAL2 iftest1.c
+VAL3 iftest1.c
+VAL4 iftest1.c
+], [])
 
 AT_CLEANUP(configure)
__________________________




reply via email to

[Prev in Thread] Current Thread [Next in Thread]