Raymond Toy pushed to branch issue-386-generate-def-unix-error at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • bin/create-def-unix-error.awk
    ... ... @@ -4,27 +4,26 @@ BEGIN {
    4 4
     
    
    5 5
     # Find anything that matches '#define Efoo value'
    
    6 6
     /^#define[ \t]+(E[A-Z0-9]+)[ \t]+([A-Z0-9]+).*$/ {
    
    7
    -    # If we haven't found $2 in errno before, add it to the table.
    
    8
    -    # This is to catch any duplicates.  We assume the latter value is
    
    9
    -    # NOT what we want.  This happens on Darwin where EOPNOSUPP is
    
    10
    -    # defined twice due to #if's.
    
    11 7
         found = 0
    
    8
    +    # Search to see if the current key, $2, is already in the table.
    
    9
    +    # If so, we mark it as something to skip.  This happens on Darwin
    
    10
    +    # where EOPNTOSUPP is seen twice.  We want the second entry.
    
    12 11
         for (key in errno) {
    
    13 12
     	if (errno[key] == $2) {
    
    14
    -	    printf ";; Ignoring dup of %s: old value %d, new value %\n", $2, errno[key], $3;
    
    13
    +	    printf ";; Ignoring dup of %s: old value %s, new value %s\n", $2, value[key], $3;
    
    15 14
     	    found = 1;
    
    15
    +	    skip[key] = 1;
    
    16 16
     	    break;
    
    17 17
            }
    
    18 18
         }
    
    19
    -    if (!found) {
    
    20
    -	errno[count] = $2;
    
    21
    -	value[count] = $3;
    
    22
    -	++count;
    
    23
    -    }
    
    19
    +    errno[count] = $2;
    
    20
    +    value[count] = $3;
    
    21
    +    ++count;
    
    24 22
     }
    
    25 23
     
    
    26 24
     END {
    
    27 25
         for (k = 0; k < count; ++k) {
    
    28
    -	printf "(def-unix-error %s %s)\n", errno[k], value[k];
    
    26
    +	printf "%s(def-unix-error %s %s)\n",
    
    27
    +	    (skip[k] != 1) ? "": ";; ", errno[k], value[k];
    
    29 28
         }
    
    30 29
     }