https://gcc.gnu.org/g:cc4718b5802818ad87c2f7a28c9fa6ac8c113da7

commit r16-6466-gcc4718b5802818ad87c2f7a28c9fa6ac8c113da7
Author: Jose E. Marchesi <[email protected]>
Date:   Fri Jan 2 10:09:37 2026 +0100

    a68: avoid conditional expression in sppp.awk
    
    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 <[email protected]>
    
    libga68/ChangeLog
    
            * sppp.awk: Avoid conditional expression.

Diff:
---
 libga68/sppp.awk | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libga68/sppp.awk b/libga68/sppp.awk
index e793ee815036..8ab94bac6363 100644
--- a/libga68/sppp.awk
+++ b/libga68/sppp.awk
@@ -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]

Reply via email to