bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* groff: error after update of gnulib, 13th January 2023
@ 2023-01-13  1:43 Bjarni Ingi Gislason
  2023-01-13  2:25 ` Bruno Haible
  0 siblings, 1 reply; 5+ messages in thread
From: Bjarni Ingi Gislason @ 2023-01-13  1:43 UTC (permalink / raw)
  To: bug-gnulib

Software: groff

  I got these warnings in directory "groff/build" after an update of
gnulib (13th January), commit 2886cca8398f4c5a4d68368a19c0e6d0ff97c739 

  CC       lib/libgnu_a-openat-die.o
In file included from ../lib/openat-die.c:25:
../src/include/error.h:22:44: warning: type defaults to 'int' in declaration of 'errarg' [-Wimplicit-int]
   22 |                                      const errarg &arg1 = empty_errarg,
      |                                            ^~~~~~
../src/include/error.h:22:51: error: expected ';', ',' or ')' before '&' token
   22 |                                      const errarg &arg1 = empty_errarg,
      |                                                   ^
../src/include/error.h:27:37: warning: type defaults to 'int' in declaration of 'errarg' [-Wimplicit-int]
   27 |                               const errarg & = empty_errarg,
      |                                     ^~~~~~
../src/include/error.h:27:44: error: expected ';', ',' or ')' before '&' token
   27 |                               const errarg & = empty_errarg,
      |                                            ^
../src/include/error.h:32:39: warning: type defaults to 'int' in declaration of 'errarg' [-Wimplicit-int]
   32 |                                 const errarg & = empty_errarg,
      |                                       ^~~~~~
../src/include/error.h:32:46: error: expected ';', ',' or ')' before '&' token
   32 |                                 const errarg & = empty_errarg,
      |                                              ^
../src/include/error.h:37:37: warning: type defaults to 'int' in declaration of 'errarg' [-Wimplicit-int]
   37 |                               const errarg & = empty_errarg,
      |                                     ^~~~~~
../src/include/error.h:37:44: error: expected ';', ',' or ')' before '&' token
   37 |                               const errarg & = empty_errarg,
      |                                            ^
../src/include/error.h:42:18: warning: type defaults to 'int' in declaration of 'errarg' [-Wimplicit-int]
   42 |            const errarg & = empty_errarg,
      |                  ^~~~~~
../src/include/error.h:42:25: error: expected ';', ',' or ')' before '&' token
   42 |            const errarg & = empty_errarg,
      |                         ^
../src/include/error.h:47:18: warning: type defaults to 'int' in declaration of 'errarg' [-Wimplicit-int]
   47 |            const errarg & = empty_errarg,
      |                  ^~~~~~
../src/include/error.h:47:25: error: expected ';', ',' or ')' before '&' token
   47 |            const errarg & = empty_errarg,
      |                         ^
../src/include/error.h:52:20: warning: type defaults to 'int' in declaration of 'errarg' [-Wimplicit-int]
   52 |              const errarg & = empty_errarg,
      |                    ^~~~~~
../src/include/error.h:52:27: error: expected ';', ',' or ')' before '&' token
   52 |              const errarg & = empty_errarg,
      |                           ^
../src/include/error.h:57:18: warning: type defaults to 'int' in declaration of 'errarg' [-Wimplicit-int]
   57 |            const errarg & = empty_errarg,
      |                  ^~~~~~
../src/include/error.h:57:25: error: expected ';', ',' or ')' before '&' token
   57 |            const errarg & = empty_errarg,
      |                         ^
../src/include/error.h:62:8: error: expected identifier or '(' before string constant
   62 | extern "C" const char *program_name;
      |        ^~~
../lib/openat-die.c: In function 'openat_save_fail':
../lib/openat-die.c:37:3: warning: implicit declaration of function 'error'; did you mean 'strerror'? [-Wimplicit-function-declaration]
   37 |   error (exit_failure, errnum,
      |   ^~~~~
      |   strerror
--- ../lib/openat-die.c
+++ ../lib/openat-die.c
@@ -34,7 +34,7 @@
 openat_save_fail (int errnum)
 {
 #ifndef GNULIB_LIBPOSIX
-  error (exit_failure, errnum,
+  strerror (exit_failure, errnum,
          _("unable to record current working directory"));
 #endif
   /* _Noreturn cannot be applied to error, since it returns
make[1]: *** [Makefile:9024: lib/libgnu_a-openat-die.o] Error 1
make[1]: Leaving directory '/home/bg/git/groff/build'
make: *** [Makefile:6823: all] Error 2

######

  "error.h" is a local file with:

// -*- C++ -*-
/* Copyright (C) 1989-2020 Free Software Foundation, Inc.
     Written by James Clark (jjc@jclark.com)
[...]
class errarg {
  enum { EMPTY, STRING, CHAR, INTEGER, UNSIGNED_INTEGER, DOUBLE } type;
  union {
    const char *s;
    int n;
    unsigned int u;
    char c;
    double d;
  };
 public:
  errarg();
  errarg(const char *);
  errarg(char);
  errarg(unsigned char);
  errarg(int);
  errarg(unsigned int);
  errarg(double);
  int empty() const;
  void print() const;
};

extern errarg empty_errarg;

extern void errprint(const char *,
                     const errarg &arg1 = empty_errarg,
                     const errarg &arg2 = empty_errarg,
                     const errarg &arg3 = empty_errarg);

#####

  The bootstrap.conf is:

# Bootstrap configuration.

# Copyright (C) 2006-2022 Free Software Foundation, Inc.

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.


# gnulib m4 macro 
m4_base=gnulib_m4

# gnulib C source files
source_base=lib

# additional standard files, particularly added by 
# automake --add-missing
build_aux=build-aux

gnulib_name=libgnu

# This file is not distributed and used to check if the bootstrap
# script is not launched on a tarball
checkout_only_file=README.git

# gnulib modules used by this package.
# havelib provides config.rpath
# can be get through gettext though
# gen-header added 25th December 2021
# non-recursive-gnulib-prefix-hack removed 22th January 2022

gnulib_modules="
    git-version-gen
    havelib
    manywarnings
    wcwidth
    fprintf-posix
    gen-header
    snprintf
    vsnprintf-posix
    warnings
  mkstemp
  fmod
  getcwd
  putenv
  strcase
  strerror
  strtol
  setlocale
  stdckdint
  assert
  assert-h
  idx
  string
  strings
 "
# non-recursive-gnulib-prefix-hack was removed as deprecated
# (around 20th December 2021)

# Name of the Makefile.am
gnulib_tool_option_extras="
    --makefile-name=gnulib.mk
    --automake-subdir"

# Additional xgettext options to use.  Use "\\\newline" to break lines.
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
 --from-code=UTF-8\\\
 --flag=asprintf:2:c-format --flag=vasprintf:2:c-format\\\
 --flag=asnprintf:3:c-format --flag=vasnprintf:3:c-format\\\
 --flag=wrapf:1:c-format\\\
'

# If "AM_GNU_GETTEXT(external" or "AM_GNU_GETTEXT([external]"
# appears in configure.ac, exclude some unnecessary files.
# Without grep's -E option (not portable enough, pre-configure),
# the following test is ugly.  Also, this depends on the existence
# of configure.ac, not the obsolescent-named configure.in.  But if
# you're using this infrastructure, you should care about such things.

gettext_external=0
grep '^[	 ]*AM_GNU_GETTEXT(external\>' configure.ac > /dev/null &&
  gettext_external=1
grep '^[	 ]*AM_GNU_GETTEXT(\[external\]' configure.ac > /dev/null &&
  gettext_external=1

if test $gettext_external = 1; then
  # Gettext supplies these files, but we don't need them since
  # we don't have an intl subdirectory.
  excluded_files='
      m4/glibc2.m4
      m4/intdiv0.m4
      m4/lcmessage.m4
      m4/lock.m4
      m4/printf-posix.m4
      m4/size_max.m4
      m4/uintmax_t.m4
      m4/ulonglong.m4
      m4/visibility.m4
      m4/xsize.m4
  '
fi

# Build prerequisites
buildreq="\
autoconf   2.68
automake   1.12.2
git        1.5.5
libtool    2.2.2
tar        -
pkg-config -
"

bootstrap_post_import_hook ()
{
  # Automake requires that ChangeLog exist.
  touch ChangeLog || return 1
}

####

  About "GNULIB_LIBPOSIX":

  There exists a file "STATUS-libposix".

  The macro is used in "lib/oppenat-die.c:25 and ChangeLog:

--- Citation---

2010-12-30  Bruce Korb  <bkorb@gnu.org>

        libposix: avoid calling error() within libposix
        * lib/openat-die.c: remove error module stuff when
GNULIB_LIBPOSIX
        is defined.
--- End of citation

 


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

* Re: groff: error after update of gnulib, 13th January 2023
  2023-01-13  1:43 groff: error after update of gnulib, 13th January 2023 Bjarni Ingi Gislason
@ 2023-01-13  2:25 ` Bruno Haible
  2023-01-13 19:09   ` Bjarni Ingi Gislason
  0 siblings, 1 reply; 5+ messages in thread
From: Bruno Haible @ 2023-01-13  2:25 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Bjarni Ingi Gislason

Bjarni Ingi Gislason wrote:
> ../lib/openat-die.c:37:3: warning: implicit declaration of function 'error'; did you mean 'strerror'? [-Wimplicit-function-declaration]
>    37 |   error (exit_failure, errnum,
> ...
>   "error.h" is a local file with:
> 
> // -*- C++ -*-
> /* Copyright (C) 1989-2020 Free Software Foundation, Inc.
>      Written by James Clark (jjc@jclark.com)
> [...]
> class errarg {

The 'openat-die' module depends on the 'error' module
https://www.gnu.org/software/gnulib/MODULES.html#module=error

So you now have a conflict between Gnulib's error.h (which is
meant to make glibc's error.h portable) and groff's error.h.

Also, at link time, some linkers might be confused between the error.o
file from Gnulib (which is meant to contain glibc compatible error()
and error_at_line() functions) and groff's error.o.

What has changed between yesterday and today is that, in VPATH builds,
Gnulib's error.h was in the source directory and is now in the build
directory. Depending on the order of -I options the other error.h
is now visible.

Bruno





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

* Re: groff: error after update of gnulib, 13th January 2023
  2023-01-13  2:25 ` Bruno Haible
@ 2023-01-13 19:09   ` Bjarni Ingi Gislason
  2023-01-13 21:56     ` Bruno Haible
  0 siblings, 1 reply; 5+ messages in thread
From: Bjarni Ingi Gislason @ 2023-01-13 19:09 UTC (permalink / raw)
  To: Bruno Haible; +Cc: bug-gnulib

  Thanks for some insights.

  I reverted the commit to get the compilation error-free.

  Some observations with the commit added

1)  /lib/error.h is not compiled from /lib/error.in.h
   It is there when the commit is abset.

2) with the commit, the config.log contains

GL_GENERATE_ERROR_H_FALSE=''
GL_GENERATE_ERROR_H_TRUE='#'

  and the Makefile contains

# We need the following in order to create <error.h> when the system
# doesn't have one that works.
#lib/error.h: lib/error.in.h $(top_builddir)/config.status $(CXXDEFS_H)
#       $(AM_V_GEN)$(MKDIR_P) 'lib'
#       $(gl_V_at)$(SED_HEADER_STDOUT) \
#             -e 's|@''HAVE_ERROR''@|$(HAVE_ERROR)|g' \
#             -e 's|@''HAVE_ERROR_AT_LINE''@|$(HAVE_ERROR_AT_LINE)|g' \
#             -e 's|@''REPLACE_ERROR''@|$(REPLACE_ERROR)|g' \
#             -e 's|@''REPLACE_ERROR_AT_LINE''@|$(REPLACE_ERROR_AT_LINE)|g' \
#             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
#             $(top_srcdir)/lib/error.in.h > $@-t
#       $(AM_V_at)mv $@-t $@
lib/error.h: $(top_builddir)/config.status
        rm -f $@



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

* Re: groff: error after update of gnulib, 13th January 2023
  2023-01-13 19:09   ` Bjarni Ingi Gislason
@ 2023-01-13 21:56     ` Bruno Haible
  2023-01-13 23:33       ` Bjarni Ingi Gislason
  0 siblings, 1 reply; 5+ messages in thread
From: Bruno Haible @ 2023-01-13 21:56 UTC (permalink / raw)
  To: Bjarni Ingi Gislason; +Cc: bug-gnulib

Bjarni Ingi Gislason wrote:
> 2) with the commit, the config.log contains
> 
> GL_GENERATE_ERROR_H_FALSE=''
> GL_GENERATE_ERROR_H_TRUE='#'
> 
>   and the Makefile contains
> 
> lib/error.h: $(top_builddir)/config.status
>         rm -f $@

That's because you happen to do this build on a platform which already
has /usr/include/error.h. On the other platforms error.h gets created in
the build directory, from error.in.h.

You cannot have a reliable build system if the same include file basename
(here: "error.h") is used to denote two different .h files, one that
declares error_at_line, and one which declares groff C++ classes. This
will *never* be reliable, regardless how to attempt to arrange the -I
options in the AM_CPPFLAGS.

Bruno





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

* Re: groff: error after update of gnulib, 13th January 2023
  2023-01-13 21:56     ` Bruno Haible
@ 2023-01-13 23:33       ` Bjarni Ingi Gislason
  0 siblings, 0 replies; 5+ messages in thread
From: Bjarni Ingi Gislason @ 2023-01-13 23:33 UTC (permalink / raw)
  To: Bruno Haible; +Cc: bug-gnulib

  Thanks for this.

  I renamed "error.h" in groff to "groff_error.h".


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

end of thread, other threads:[~2023-01-13 23:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13  1:43 groff: error after update of gnulib, 13th January 2023 Bjarni Ingi Gislason
2023-01-13  2:25 ` Bruno Haible
2023-01-13 19:09   ` Bjarni Ingi Gislason
2023-01-13 21:56     ` Bruno Haible
2023-01-13 23:33       ` Bjarni Ingi Gislason

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 read-only IMAP folder(s) and NNTP newsgroup(s).