From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id 3df95041 for ; Thu, 10 Jan 2019 01:29:30 -0500 (EST) Date: Thu, 10 Jan 2019 01:29:30 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: Initializers for file-scope static variables should be X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: Log Message: ----------- Initializers for file-scope static variables should be compile-time constants, and while stderr is a compile-time constant in OpenBSD, Kelvin Sherlock reports that it isn't on some other systems, for example on FreeBSD or Linux. So do the initialization by calling mandoc_msg_setoutfile() from main() instead. Modified Files: -------------- mandoc: main.c mandoc_msg.c Revision Data ------------- Index: main.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/main.c,v retrieving revision 1.316 retrieving revision 1.317 diff -Lmain.c -Lmain.c -u -p -r1.316 -r1.317 --- main.c +++ main.c @@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons - * Copyright (c) 2010-2012, 2014-2018 Ingo Schwarze + * Copyright (c) 2010-2012, 2014-2019 Ingo Schwarze * Copyright (c) 2010 Joerg Sonnenberger * * Permission to use, copy, modify, and distribute this software for any @@ -148,6 +148,7 @@ main(int argc, char *argv[]) setprogname(progname); #endif + mandoc_msg_setoutfile(stderr); if (strncmp(progname, "mandocdb", 8) == 0 || strcmp(progname, BINM_MAKEWHATIS) == 0) return mandocdb(argc, argv); Index: mandoc_msg.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/mandoc_msg.c,v retrieving revision 1.4 retrieving revision 1.5 diff -Lmandoc_msg.c -Lmandoc_msg.c -u -p -r1.4 -r1.5 --- mandoc_msg.c +++ mandoc_msg.c @@ -240,7 +240,7 @@ static const char *const type_message[MA "ignoring macro in table", }; -static FILE *fileptr = stderr; +static FILE *fileptr = NULL; static const char *filename = NULL; static enum mandocerr min_type = MANDOCERR_MAX; static enum mandoclevel rc = MANDOCLEVEL_OK; -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv