]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgcobol: Allow for lack of LOG_PERROR
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Tue, 13 May 2025 07:43:48 +0000 (09:43 +0200)
committerRobert Dubner <rdubner@symas.com>
Tue, 29 Jul 2025 16:06:38 +0000 (12:06 -0400)
The libgcobol build is broken again on Solaris:

/vol/gcc/src/hg/master/local/libgcobol/libgcobol.cc: In function ‘void
default_exception_handler(ec_type_t)’:
/vol/gcc/src/hg/master/local/libgcobol/libgcobol.cc:11196:44: error:
‘LOG_PERROR’ was not declared in this scope; did you mean ‘LOG_ERR’?
11196 | static int priority = LOG_INFO, option = LOG_PERROR, facility =
LOG_USER;
      |                                            ^~~~~~~~~~
      |                                            LOG_ERR
/vol/gcc/src/hg/master/local/libgcobol/libgcobol.cc:11202:28: error:
‘facility’ was not declared in this scope
11202 |     openlog(ident, option, facility);
      |                            ^~~~~~~~

LOG_PERROR is a BSD extension not present on Solaris due to its System V
heritage, and Linux syslog(3) documents:

       LOG_PERROR     (Not in POSIX.1-2001 or  POSIX.1-2008.)   Also  log  the
                      message to stderr.

This patch provides a fallback definition, just the minimum to unbreak
the build.

Tested on amd64-pc-solaris2.11, sparcv9-sun-solaris2.11, and
x86_64-pc-linux-gnu.

2025-05-12  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

libgcobol:
* libgcobol.cc [!LOG_PERROR] (LOG_PERROR): Provide fallback.

(cherry picked from commit 90fee97d528e8447648c37f9df1daa3445e598bc)

libgcobol/libgcobol.cc

index 2de87cbfc487caea2595748bef0206e271d2096e..56b1a7bf5876053f8e287dc087b1d487c6306f14 100644 (file)
 
 #include "exceptl.h"
 
+/* BSD extension.  */
+#if !defined(LOG_PERROR)
+#define LOG_PERROR 0
+#endif
+
 #if !defined (HAVE_STRFROMF32)
 # if __FLT_MANT_DIG__ == 24 && __FLT_MAX_EXP__ == 128
 static int