bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

__nonnull on DragonFlyBSD 5.9


From: Gavin Smith
Subject: __nonnull on DragonFlyBSD 5.9
Date: Wed, 10 Mar 2021 22:29:40 +0000
User-agent: Mutt/1.9.4 (2018-02-28)

I'm hoping for some help tracking down an error trying to compile Texinfo
on DragonFlyBSD 5.9.  The error message is as follows:

depbase=`echo basename-lgpl.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; gcc 
-DHAVE_CONFIG_H -I. -I../..      -g -O2 -MT basename-lgpl.o -MD -MP -MF 
$depbase.Tpo -c -o basename-lgpl.o basename-lgpl.c && mv -f $depbase.Tpo 
$depbase.Po
depbase=`echo malloc/dynarray_at_failure.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; 
gcc -DHAVE_CONFIG_H -I. -I../..      -g -O2 -MT malloc/dynarray_at_failure.o 
-MD -MP -MF $depbase.Tpo -c -o malloc/dynarray_at_failure.o 
malloc/dynarray_at_failure.c && mv -f $depbase.Tpo $depbase.Po
In file included from ./libc-config.h:33,
                 from ./dynarray.h:22,
                 from malloc/dynarray_at_failure.c:19:
/usr/include/stdlib.h:182:46: error: expected ')' before numeric constant
 int  posix_memalign(void **, size_t, size_t) __nonnull(1); /* (ADV) */
                                              ^~~~~~~~~
../../config.h:1233:71: error: expected ',' or ';' before ')' token
 # define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args))
                                                                       ^
                                                                       ^

The malloc/dynarray_at_failure.c file is fairly new in Gnulib
(added 2021-01-08) but I don't think it is a problem with that file
specifically.  The code around the line in config.h is the following:

#if _GL_HAS_ATTRIBUTE (nonnull)
# define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args))
#else
# define _GL_ATTRIBUTE_NONNULL(args)
#endif

and there is also a definition in cdefs.h:

/* The nonnull function attribute marks pointer parameters that
   must not be NULL.  */
#ifndef __nonnull
# if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__)
#  define __nonnull(params) __attribute__ ((__nonnull__ params))
# else
#  define __nonnull(params)
# endif
#elif !defined __GLIBC__
# undef __nonnull
# define __nonnull(params) _GL_ATTRIBUTE_NONNULL (params)
#endif


I've spent quite a while trying to isolate the problem but couldn't
get it down to a very small input file.  When I commented out the last
two but one lines in the code above from cdefs.h, the compilation continued.
I guess on this system, __GLIBC__ is not defined, but this is not a
correct definition of __nonnull.

There was the following recent change that could be responsible:

2021-01-23  Paul Eggert  <eggert@cs.ucla.edu>

        libc-config: port to Xcode 7
        Problem reported by Mattias Engdegård in:
        https://lists.gnu.org/r/emacs-devel/2021-01/msg01089.html
        * lib/cdefs.h (__nonnull): If already defined but glibc is not in
        use, override the definition with Gnulib’s _GL_ATTRIBUTE_NONNULL.
        This is needed for Xcode 7, which has a ‘#define __nonnull
        _Nonnull’ builtin for backwards-compatibility with an older Xcode
        syntax that GNUish code never uses.

I don't know how to find what the definition of __nonnull is on DragonFlyBSD
but if I put the following in test.c:

#include <stdlib.h>

__nonnull(1)

and then run "gcc -E test.c", the output ends with

# 2 "tmp.c" 2

__attribute__((__nonnull__(
# 3 "tmp.c"
1
# 3 "tmp.c" 3 4
)))

Maybe the difference is the brackets around the argument to __nonnull__,
which seem to be missing in the definition of _GL_ATTRIBUTE_NONNULL.  Is
there any other information I could provide to help solve the problem?

$ gcc --version
gcc 8.3 [DragonFly] Release/2019-02-22
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.

 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]