From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from scc-mailout-kit-01.scc.kit.edu (scc-mailout-kit-01.scc.kit.edu [129.13.231.81]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTP id ccf0d32e for ; Wed, 13 Mar 2019 13:38:21 -0500 (EST) Received: from asta-nat.asta.uni-karlsruhe.de ([172.22.63.82] helo=hekate.usta.de) by scc-mailout-kit-01.scc.kit.edu with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (envelope-from ) id 1h48ld-0005Nb-V7; Wed, 13 Mar 2019 19:38:19 +0100 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.77) (envelope-from ) id 1h48la-0004wn-Kf; Wed, 13 Mar 2019 19:38:14 +0100 Received: from athene.usta.de ([172.24.96.10]) by donnerwolke.usta.de with esmtp (Exim 4.84_2) (envelope-from ) id 1h48la-0006Wo-GC; Wed, 13 Mar 2019 19:38:14 +0100 Received: from localhost (athene.usta.de [local]) by athene.usta.de (OpenSMTPD) with ESMTPA id 56a2f510; Wed, 13 Mar 2019 19:38:14 +0100 (CET) Date: Wed, 13 Mar 2019 19:38:14 +0100 From: Ingo Schwarze To: Stephen Gregoratto Cc: discuss@mandoc.bsd.lv, christos@netbsd.org Subject: Re: man_validate.c compile errors on Linux gcc/clang Message-ID: <20190313183814.GC46802@athene.usta.de> References: <20190313013235.najhyodv2hpboasu@BlackBox> X-Mailinglist: mandoc-discuss Reply-To: discuss@mandoc.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190313013235.najhyodv2hpboasu@BlackBox> User-Agent: Mutt/1.8.0 (2017-02-23) Hi Stephen, Stephen Gregoratto wrote on Wed, Mar 13, 2019 at 12:32:35PM +1100: > The latest patches to man_validate.c do not compile on my Linux machines > using gcc/clang. Only my OpenBSD server can complete fully. Thank you for reporting this issue. I (hopefully) fixed it with the commit below. Can you confirm that the fix works? Yours, Ingo Log Message: ----------- Contrary to what the NetBSD attribute(3) manual page suggests, using __dead instead of __attribute__((__noreturn__)) actually hinders portability rather than helping it. Given that mandoc already uses __attribute__ in several files and that in the portable version, ./configure already contains rudimentary support for ignoring it on platforms that do not support it, use __attribute__ directly. This is expected to fix build failures that Stephen Gregoratto reported from Arch and Debian Linux. Modified Files: -------------- mandoc: man_validate.c mdoc_validate.c Revision Data ------------- Index: mdoc_validate.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/mdoc_validate.c,v retrieving revision 1.372 retrieving revision 1.373 diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.372 -r1.373 --- mdoc_validate.c +++ mdoc_validate.c @@ -64,7 +64,7 @@ static size_t macro2len(enum roff_tok); static void rewrite_macro2len(struct roff_man *, char **); static int similar(const char *, const char *); -static __dead void post_abort(POST_ARGS); +static void post_abort(POST_ARGS) __attribute__((__noreturn__)); static void post_an(POST_ARGS); static void post_an_norm(POST_ARGS); static void post_at(POST_ARGS); @@ -497,7 +497,7 @@ check_toptext(struct roff_man *mdoc, int } } -static __dead void +static void post_abort(POST_ARGS) { abort(); Index: man_validate.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/man_validate.c,v retrieving revision 1.147 retrieving revision 1.148 diff -Lman_validate.c -Lman_validate.c -u -p -r1.147 -r1.148 --- man_validate.c +++ man_validate.c @@ -41,7 +41,7 @@ typedef void (*v_check)(CHKARGS); -static __dead void check_abort(CHKARGS); +static void check_abort(CHKARGS) __attribute__((__noreturn__)); static void check_par(CHKARGS); static void check_part(CHKARGS); static void check_root(CHKARGS); @@ -196,7 +196,7 @@ check_root(CHKARGS) "(OpenBSD)" : "(NetBSD)"); } -static __dead void +static void check_abort(CHKARGS) { abort(); ----- 8< ----- schnipp ----- >8 ----- 8< ----- schnapp ----- >8 ----- > On my Arch Linux machine: > > Linux 5.0.0-arch1-1-ARCH x86_64 GNU/Linux > > gcc -g -W -Wall -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter -c -o man_validate.o man_validate.c > man_validate.c:44:14: error: expected ‘;’ before ‘void’ > static __dead void check_abort(CHKARGS); > ^~~~~ > ; > man_validate.c:199:14: error: expected ‘;’ before ‘void’ > static __dead void > ^~~~~ > ; > make: *** [: man_validate.o] Error 1 > > gcc (GCC) 8.2.1 20181127 > Copyright (C) 2018 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > > clang -g -W -Wall -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter -c -o man_validate.o man_validate.c > man_validate.c:44:8: error: unknown type name '__dead' > static __dead void check_abort(CHKARGS); > ^ > man_validate.c:44:15: error: expected identifier or '(' > static __dead void check_abort(CHKARGS); > ^ > man_validate.c:67:2: error: use of undeclared identifier 'check_abort' > check_abort,/* LP */ > ^ > man_validate.c:69:2: error: use of undeclared identifier 'check_abort' > check_abort,/* P */ > ^ > man_validate.c:199:8: error: unknown type name '__dead' > static __dead void > ^ > man_validate.c:199:15: error: expected identifier or '(' > static __dead void > ^ > 6 errors generated. > make: *** [: man_validate.o] Error 1 > > clang version 7.0.1 (tags/RELEASE_701/final) > Target: x86_64-pc-linux-gnu > Thread model: posix > InstalledDir: /usr/bin > > On my Debian 9 Server: > > Linux mail.sgregoratto.me 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3 (2019-02-02) x86_64 GNU/Linux > > gcc -g -W -Wall -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter -c -o man_validate.o man_validate.c > man_validate.c:44:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’ > static __dead void check_abort(CHKARGS); > ^~~~ > man_validate.c:67:2: error: ‘check_abort’ undeclared here (not in a function) > check_abort,/* LP */ > ^~~~~~~~~~~ > man_validate.c:199:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’ > static __dead void > ^~~~ > : recipe for target 'man_validate.o' failed > make: *** [man_validate.o] Error 1 > > gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 > Copyright (C) 2016 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR > PURPOSE. > > I'm unsure if __dead is defined in glibc. I couldn't find it under > . -- To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv