GNU bug report logs - #78882
stty.c compilation error

Previous Next

Package: coreutils;

Reported by: Bruno Haible <bruno <at> clisp.org>

Date: Mon, 23 Jun 2025 21:15:04 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Bruno Haible <bruno <at> clisp.org>
To: 78882 <at> debbugs.gnu.org
Cc: "H. Peter Anvin" <hpa <at> zytor.com>
Subject: bug#78882: stty.c compilation error
Date: Mon, 23 Jun 2025 23:14:05 +0200
[Message part 1 (text/plain, inline)]
Hi,

The coreutils CI fails today on OpenBSD and Solaris. (The previous build,
a week ago, succeeded.)

Compilation error on OpenBSD:

cc  -I. -I.. -I./lib  -Ilib -I../lib -Isrc -I../src -I/usr/local/include -Wall  -Wno-format-extra-args -Wno-implicit-const-int-float-conversion -Wno-tautological-constant-out-of-range-compare -g -O2 -MT src/stty.o -MD -MP -MF $depbase.Tpo -c -o src/stty.o ../src/stty.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from ../src/stty.c:2177:
src/speedlist.h:156:4: error: unterminated conditional directive
#  ifdef B4000000n      case 4000000: return B4000000;n#  endif
   ^
src/speedlist.h:155:4: error: unterminated conditional directive
#  ifdef B3500000n      case 3500000: return B3500000;n#  endif
   ^
...

Compilation error on Solaris 11.4:

gcc -m64  -I. -I.. -I./lib  -Ilib -I../lib -Isrc -I../src  -Wall -D_REENTRANT  -g -O2 -MT src/stty.o -MD -MP -MF $depbase.Tpo -c -o src/stty.o ../src/stty.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from ../src/stty.c:2177:
src/speedlist.h: In function ‘baud_to_value’:
src/speedlist.h:60:19: warning: extra tokens at end of #ifdef directive
   60 | #  ifdef B0n      case B0: return 0;n#  endif
      |                   ^~~~
src/speedlist.h:156: error: unterminated #ifdef
  156 | #  ifdef B4000000n      case 4000000: return B4000000;n#  endif
src/speedlist.h:155: error: unterminated #ifdef
...


It looks like the 'speedgen' script, added in commit
357fda90d15fd3f7dba61e1ab322b183a48d0081, produces this invalid C code.

With GNU sed:

$ echo 100 | sed -e 's/^.*$/#  ifdef B&\n      case B&: return &;\n#  endif/'
#  ifdef B100
      case B100: return 100;
#  endif

With OpenBSD sed and Solaris sed:

$ echo 100 | sed -e 's/^.*$/#  ifdef B&\n      case B&: return &;\n#  endif/'
#  ifdef B100n      case B100: return 100;n#  endif

The attached patch fixes it.


[0001-build-Fix-compilation-error-on-OpenBSD-and-Solaris.patch (text/x-patch, attachment)]

This bug report was last modified 20 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.