]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
a68: avoid conditional expression in sppp.awk
authorJose E. Marchesi <jose.marchesi@oracle.com>
Fri, 2 Jan 2026 09:09:37 +0000 (10:09 +0100)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Fri, 2 Jan 2026 09:58:34 +0000 (10:58 +0100)
The macOS awk seems to not like having an unparenthesized conditional
expression as the last argument to printf.  This commit workarounds
this by simply replacing the conditional expression with a conditional
statement.

Tested with gawk and mawk.

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
libga68/ChangeLog

* sppp.awk: Avoid conditional expression.

libga68/sppp.awk

index e793ee8150367cddb029a4a456a7472864d43127..8ab94bac63633196f09cfb70713d6fc07e523b14 100644 (file)
@@ -114,7 +114,11 @@ BEGIN {
         {
             while (sub ("\\{" iter_name "\\}", iterators[iter_name,nalt], output)) {}
         }
-        printf "%s%s\n", substr (output, 0, length(output) - 1), nalt < num_alternatives ? separator : ""
+        if (nalt < num_alternatives)
+            sep = separator
+        else
+            sep = ""
+        printf "%s%s\n", substr (output, 0, length(output) - 1), sep
     }
 
     for (key in iter_names) delete iter_names[key]