discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
* man_validate.c compile errors on Linux gcc/clang
@ 2019-03-13  1:32 Stephen Gregoratto
  2019-03-13 18:38 ` Ingo Schwarze
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Gregoratto @ 2019-03-13  1:32 UTC (permalink / raw)
  To: discuss

The latest patches to man_validate.c do not compile on my Linux machines 
using gcc/clang. Only my OpenBSD server can complete fully.

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: *** [<builtin>: 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: *** [<builtin>: 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
               ^~~~
<builtin>: 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 
<sys/cdefs/h>.
-- 
Stephen Gregoratto
PGP: 3FC6 3D0E 2801 C348 1C44 2D34 A80C 0F8E 8BAB EC8B
--
 To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: man_validate.c compile errors on Linux gcc/clang
  2019-03-13  1:32 man_validate.c compile errors on Linux gcc/clang Stephen Gregoratto
@ 2019-03-13 18:38 ` Ingo Schwarze
  2019-03-14  1:11   ` Stephen Gregoratto
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Schwarze @ 2019-03-13 18:38 UTC (permalink / raw)
  To: Stephen Gregoratto; +Cc: discuss, christos

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 
<dev at sgregoratto dot me> 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: *** [<builtin>: 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: *** [<builtin>: 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
>                ^~~~
> <builtin>: 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 
> <sys/cdefs/h>.
--
 To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: man_validate.c compile errors on Linux gcc/clang
  2019-03-13 18:38 ` Ingo Schwarze
@ 2019-03-14  1:11   ` Stephen Gregoratto
  2019-03-14  1:30     ` Stephen Gregoratto
  2019-03-14 11:45     ` Ingo Schwarze
  0 siblings, 2 replies; 5+ messages in thread
From: Stephen Gregoratto @ 2019-03-14  1:11 UTC (permalink / raw)
  To: discuss; +Cc: christos

On 2019-03-13 19:38, Ingo Schwarze wrote:
> Thank you for reporting this issue.
> I (hopefully) fixed it with the commit below.
> Can you confirm that the fix works?
Yes, it does. Thanks for your help Ingo. I've actually found another 
(small) error with gcc on SunOS 5.10, but I'll put that under a new 
topic.
-- 
Stephen Gregoratto
PGP: 3FC6 3D0E 2801 C348 1C44 2D34 A80C 0F8E 8BAB EC8B
--
 To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: man_validate.c compile errors on Linux gcc/clang
  2019-03-14  1:11   ` Stephen Gregoratto
@ 2019-03-14  1:30     ` Stephen Gregoratto
  2019-03-14 11:45     ` Ingo Schwarze
  1 sibling, 0 replies; 5+ messages in thread
From: Stephen Gregoratto @ 2019-03-14  1:30 UTC (permalink / raw)
  To: discuss; +Cc: christos

Actually, scratch that last claim because I cannot reproduce it on a 
clean build.
-- 
Stephen Gregoratto
PGP: 3FC6 3D0E 2801 C348 1C44 2D34 A80C 0F8E 8BAB EC8B
--
 To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: man_validate.c compile errors on Linux gcc/clang
  2019-03-14  1:11   ` Stephen Gregoratto
  2019-03-14  1:30     ` Stephen Gregoratto
@ 2019-03-14 11:45     ` Ingo Schwarze
  1 sibling, 0 replies; 5+ messages in thread
From: Ingo Schwarze @ 2019-03-14 11:45 UTC (permalink / raw)
  To: Stephen Gregoratto; +Cc: discuss

Hi Stephen,

Stephen Gregoratto wrote on Thu, Mar 14, 2019 at 12:11:29PM +1100:
> On 2019-03-13 19:38, Ingo Schwarze wrote:

>> Thank you for reporting this issue.
>> I (hopefully) fixed it with the commit below.
>> Can you confirm that the fix works?

> Yes, it does.

Thank you for re-testing and confirming!

Mandoc is now being actively maintained on 15 different operating
systems (even though in that number, i did not count system variations,
different system versions, and systems where the port or package
is outdated by more than one mandoc version; counting all systems
it was ever successfully tested on would probably amount to about
50...) and that level of portability can only be maintained when
there are several people providing exactly the kind of help you are
providing here.

> I've actually found another (small) error with gcc on SunOS 5.10,
> but I'll put that under a new topic.
[...]
> Actually, scratch that last claim because I cannot reproduce it
> on a clean build.

OK, so i'll assume there are no known problems on SunOS 5.10 unless
somebody finds and reports evidence to the contrary.  In fact, i
recently did release testing on SunOS 5.10 myself and did not
encounter problems either.

There was a report of some minor problems on SmartOS (which is an
illumos distribution and hence in some respects akin to SunOS 5.10)
though; the reporter promised to send more details what exactly
goes wrong on SmartOS when he finds the time, such that i will
hopeful be able to fix those issues.

Yours,
  Ingo
--
 To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-14 11:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-13  1:32 man_validate.c compile errors on Linux gcc/clang Stephen Gregoratto
2019-03-13 18:38 ` Ingo Schwarze
2019-03-14  1:11   ` Stephen Gregoratto
2019-03-14  1:30     ` Stephen Gregoratto
2019-03-14 11:45     ` Ingo Schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).