[build]: Improve portability to unfree compilers.

* bootstrap.conf (gnulib_modules): Add "attribute".
* src/libs/libgroff/getopt.c:
* src/libs/libgroff/new.cpp: Include gnulib's "attribute.h" header file.
* src/libs/libgroff/getopt.c (_getopt_initialize):
* src/libs/libgroff/new.cpp (operator delete): Replace GNU C unused
  attribute syntax with gnulib's "MAYBE_UNUSED".

Thanks to Bruno Haible for the report and suggested remedy.

ANNOUNCE: Drop item about builds failing with MSVC due to GNU C-style
attribute usage.  This might no longer happen, but there could be other
reasons we don't successfully build with it.
This commit is contained in:
G. Branden Robinson 2023-04-16 00:30:29 -05:00
parent 3a3c086b47
commit 91df9959f0
5 changed files with 21 additions and 8 deletions

View File

@ -179,10 +179,6 @@ o Solaris 10 has known problems with automated tests; see the "PROBLEMS"
o There is a problem building on "newlib"-using systems when X11 support
is enabled; see the "PROBLEMS" file in the distribution archive.
o The build is known to not work with the MSVC compiler. There are no
plans to address this before C23 standardized attributes become
available.
News
====

View File

@ -1,3 +1,17 @@
2023-04-16 G. Branden Robinson <g.branden.robinson@gmail.com>
[build]: Improve portability to non-GNU, non-LLVM compilers.
* bootstrap.conf (gnulib_modules): Add "attribute".
* src/libs/libgroff/getopt.c:
* src/libs/libgroff/new.cpp: Include gnulib's "attribute.h"
header file.
* src/libs/libgroff/getopt.c (_getopt_initialize):
* src/libs/libgroff/new.cpp (operator delete): Replace GNU C
unused attribute syntax with gnulib's "MAYBE_UNUSED".
Thanks to Bruno Haible for the report and suggested remedy.
2023-03-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/libs/libxutil/XFontName.c (utoa): Rename function from

View File

@ -36,6 +36,7 @@ checkout_only_file=README.git
# havelib provides config.rpath
# can be get through gettext though
gnulib_modules="
attribute
git-version-gen
havelib
wcwidth

View File

@ -28,6 +28,8 @@
# include <config.h>
#endif
#include <attribute.h> // gnulib: MAYBE_UNUSED
#include <stdio.h>
/* This needs to come after some library #include
@ -248,8 +250,7 @@ exchange (char **argv, struct _getopt_data *d)
/* Initialize the internal data when the first call is made. */
static const char *
_getopt_initialize (__attribute__((__unused__)) int argc,
__attribute__((__unused__)) char **argv,
_getopt_initialize (MAYBE_UNUSED int argc, MAYBE_UNUSED char **argv,
const char *optstring, int posixly_correct,
struct _getopt_data *d)
{

View File

@ -16,6 +16,8 @@ for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <attribute.h> // gnulib: MAYBE_UNUSED
#include "lib.h"
#include <stddef.h>
@ -54,8 +56,7 @@ void operator delete(void *p) throw()
free(p);
}
void operator delete(void *p,
__attribute__((__unused__)) long unsigned int size)
void operator delete(void *p, MAYBE_UNUSED long unsigned int size)
{
// It's ugly to duplicate the code from delete(void *) above, but if
// we don't, g++ 6.3 can't figure out we're calling through it to