bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH 2/2] error: merge from glibc and with verror


From: Bruno Haible
Subject: Re: [PATCH 2/2] error: merge from glibc and with verror
Date: Thu, 15 Aug 2024 04:11:56 +0200

Paul Eggert wrote:
> (verror, verror_at_line): New decls and macros.

This patch breaks the ability to do library-namespacing of these symbols.

How to reproduce:
1. Create a testdir of module 'verror'.
2. Configure it.
3. Append to config.h the definitions:
    #define verror libfoo_verror
    #define verror_at_line libfoo_verror_at_line
4. $ make

(This is one of the common techniques used to produce a library that contains
Gnulib modules, without the risk of producing symbol collisions on some
platforms but not on others.)

Before the change, this worked fine.

Now, it produces compilation errors:

gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I../../gltests -I..  
-DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I../../gltests -I.. 
-I../../gltests/.. -I../gllib -I../../gltests/../gllib 
-I/inst-x86_64-64/include -Wall  -Wno-error -g -O2 -MT test-verror.o -MD -MP 
-MF $depbase.Tpo -c -o test-verror.o ../../gltests/test-verror.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from ../../gltests/test-verror.c:21:
../gllib/error.h:571: warning: "verror" redefined
  571 | #define verror(status, ...) \
      | 
In file included from ../../gltests/test-verror.c:19:
../config.h:2539: note: this is the location of the previous definition
 2539 | #define verror libfoo_verror
      | 
In file included from ../../gltests/test-verror.c:21:
../gllib/error.h:586: warning: "verror_at_line" redefined
  586 | #define verror_at_line(status, ...) \
      | 
In file included from ../../gltests/test-verror.c:19:
../config.h:2540: note: this is the location of the previous definition
 2540 | #define verror_at_line libfoo_verror_at_line
      | 
In file included from ../../gltests/test-verror.c:21:
../../gltests/test-verror.c: In function ‘test_zero’:
../gllib/error.h:572:21: error: ‘verror’ undeclared (first use in this 
function); did you mean ‘perror’?
  572 |    __gl_error_call (verror, status, __VA_ARGS__)
      |                     ^~~~~~
../gllib/error.h:418:7: note: in definition of macro ‘__gl_error_call1’
  418 |     ((function) (status, __VA_ARGS__), \
      |       ^~~~~~~~
../gllib/error.h:572:4: note: in expansion of macro ‘__gl_error_call’
  572 |    __gl_error_call (verror, status, __VA_ARGS__)
      |    ^~~~~~~~~~~~~~~
../../gltests/test-verror.c:41:3: note: in expansion of macro ‘verror’
   41 |   verror (0, 0, format, args);
      |   ^~~~~~
../gllib/error.h:572:21: note: each undeclared identifier is reported only once 
for each function it appears in
  572 |    __gl_error_call (verror, status, __VA_ARGS__)
      |                     ^~~~~~
../gllib/error.h:418:7: note: in definition of macro ‘__gl_error_call1’
  418 |     ((function) (status, __VA_ARGS__), \
      |       ^~~~~~~~
../gllib/error.h:572:4: note: in expansion of macro ‘__gl_error_call’
  572 |    __gl_error_call (verror, status, __VA_ARGS__)
      |    ^~~~~~~~~~~~~~~
../../gltests/test-verror.c:41:3: note: in expansion of macro ‘verror’
   41 |   verror (0, 0, format, args);
      |   ^~~~~~
../gllib/error.h:418:38: warning: left-hand operand of comma expression has no 
effect [-Wunused-value]
  418 |     ((function) (status, __VA_ARGS__), \
      |                                      ^
../gllib/error.h:429:8: note: in expansion of macro ‘__gl_error_call1’
  429 |      ? __gl_error_call1 (function, status, __VA_ARGS__)         \
      |        ^~~~~~~~~~~~~~~~
../gllib/error.h:572:4: note: in expansion of macro ‘__gl_error_call’
  572 |    __gl_error_call (verror, status, __VA_ARGS__)
      |    ^~~~~~~~~~~~~~~
../../gltests/test-verror.c:41:3: note: in expansion of macro ‘verror’
   41 |   verror (0, 0, format, args);
      |   ^~~~~~
../gllib/error.h:418:38: warning: left-hand operand of comma expression has no 
effect [-Wunused-value]
  418 |     ((function) (status, __VA_ARGS__), \
      |                                      ^
../gllib/error.h:433:10: note: in expansion of macro ‘__gl_error_call1’
  433 |          __gl_error_call1 (function, __errstatus, __VA_ARGS__); \
      |          ^~~~~~~~~~~~~~~~
../gllib/error.h:572:4: note: in expansion of macro ‘__gl_error_call’
  572 |    __gl_error_call (verror, status, __VA_ARGS__)
      |    ^~~~~~~~~~~~~~~
../../gltests/test-verror.c:41:3: note: in expansion of macro ‘verror’
   41 |   verror (0, 0, format, args);
      |   ^~~~~~
../../gltests/test-verror.c: In function ‘test_zero_at_line’:
../gllib/error.h:587:21: error: ‘verror_at_line’ undeclared (first use in this 
function); did you mean ‘error_at_line’?
  587 |    __gl_error_call (verror_at_line, status, __VA_ARGS__)
      |                     ^~~~~~~~~~~~~~
../gllib/error.h:418:7: note: in definition of macro ‘__gl_error_call1’
  418 |     ((function) (status, __VA_ARGS__), \
      |       ^~~~~~~~
../gllib/error.h:587:4: note: in expansion of macro ‘__gl_error_call’
  587 |    __gl_error_call (verror_at_line, status, __VA_ARGS__)
      |    ^~~~~~~~~~~~~~~
../../gltests/test-verror.c:52:3: note: in expansion of macro ‘verror_at_line’
   52 |   verror_at_line (0, 0, filename, lineno, format, args);
      |   ^~~~~~~~~~~~~~
../gllib/error.h:418:38: warning: left-hand operand of comma expression has no 
effect [-Wunused-value]
  418 |     ((function) (status, __VA_ARGS__), \
      |                                      ^
../gllib/error.h:429:8: note: in expansion of macro ‘__gl_error_call1’
  429 |      ? __gl_error_call1 (function, status, __VA_ARGS__)         \
      |        ^~~~~~~~~~~~~~~~
../gllib/error.h:587:4: note: in expansion of macro ‘__gl_error_call’
  587 |    __gl_error_call (verror_at_line, status, __VA_ARGS__)
      |    ^~~~~~~~~~~~~~~
../../gltests/test-verror.c:52:3: note: in expansion of macro ‘verror_at_line’
   52 |   verror_at_line (0, 0, filename, lineno, format, args);
      |   ^~~~~~~~~~~~~~
../gllib/error.h:418:38: warning: left-hand operand of comma expression has no 
effect [-Wunused-value]
  418 |     ((function) (status, __VA_ARGS__), \
      |                                      ^
../gllib/error.h:433:10: note: in expansion of macro ‘__gl_error_call1’
  433 |          __gl_error_call1 (function, __errstatus, __VA_ARGS__); \
      |          ^~~~~~~~~~~~~~~~
../gllib/error.h:587:4: note: in expansion of macro ‘__gl_error_call’
  587 |    __gl_error_call (verror_at_line, status, __VA_ARGS__)
      |    ^~~~~~~~~~~~~~~
../../gltests/test-verror.c:52:3: note: in expansion of macro ‘verror_at_line’
   52 |   verror_at_line (0, 0, filename, lineno, format, args);
      |   ^~~~~~~~~~~~~~
../../gltests/test-verror.c: In function ‘test_errnum’:
../gllib/error.h:572:21: error: ‘verror’ undeclared (first use in this 
function); did you mean ‘perror’?
  572 |    __gl_error_call (verror, status, __VA_ARGS__)
      |                     ^~~~~~
../gllib/error.h:418:7: note: in definition of macro ‘__gl_error_call1’
  418 |     ((function) (status, __VA_ARGS__), \
      |       ^~~~~~~~
../gllib/error.h:572:4: note: in expansion of macro ‘__gl_error_call’
  572 |    __gl_error_call (verror, status, __VA_ARGS__)
      |    ^~~~~~~~~~~~~~~
../../gltests/test-verror.c:62:3: note: in expansion of macro ‘verror’
   62 |   verror (0, EACCES, format, args);
      |   ^~~~~~
../gllib/error.h:418:38: warning: left-hand operand of comma expression has no 
effect [-Wunused-value]
  418 |     ((function) (status, __VA_ARGS__), \
      |                                      ^
../gllib/error.h:429:8: note: in expansion of macro ‘__gl_error_call1’
  429 |      ? __gl_error_call1 (function, status, __VA_ARGS__)         \
      |        ^~~~~~~~~~~~~~~~
../gllib/error.h:572:4: note: in expansion of macro ‘__gl_error_call’
  572 |    __gl_error_call (verror, status, __VA_ARGS__)
      |    ^~~~~~~~~~~~~~~
../../gltests/test-verror.c:62:3: note: in expansion of macro ‘verror’
   62 |   verror (0, EACCES, format, args);
      |   ^~~~~~
../gllib/error.h:418:38: warning: left-hand operand of comma expression has no 
effect [-Wunused-value]
  418 |     ((function) (status, __VA_ARGS__), \
      |                                      ^
../gllib/error.h:433:10: note: in expansion of macro ‘__gl_error_call1’
  433 |          __gl_error_call1 (function, __errstatus, __VA_ARGS__); \
      |          ^~~~~~~~~~~~~~~~
../gllib/error.h:572:4: note: in expansion of macro ‘__gl_error_call’
  572 |    __gl_error_call (verror, status, __VA_ARGS__)
      |    ^~~~~~~~~~~~~~~
../../gltests/test-verror.c:62:3: note: in expansion of macro ‘verror’
   62 |   verror (0, EACCES, format, args);
      |   ^~~~~~
../../gltests/test-verror.c: In function ‘test_fatal’:
../gllib/error.h:572:21: error: ‘verror’ undeclared (first use in this 
function); did you mean ‘perror’?
  572 |    __gl_error_call (verror, status, __VA_ARGS__)
      |                     ^~~~~~
../gllib/error.h:418:7: note: in definition of macro ‘__gl_error_call1’
  418 |     ((function) (status, __VA_ARGS__), \
      |       ^~~~~~~~
../gllib/error.h:572:4: note: in expansion of macro ‘__gl_error_call’
  572 |    __gl_error_call (verror, status, __VA_ARGS__)
      |    ^~~~~~~~~~~~~~~
../../gltests/test-verror.c:72:3: note: in expansion of macro ‘verror’
   72 |   verror (4, 0, format, args);
      |   ^~~~~~
../gllib/error.h:418:38: warning: left-hand operand of comma expression has no 
effect [-Wunused-value]
  418 |     ((function) (status, __VA_ARGS__), \
      |                                      ^
../gllib/error.h:429:8: note: in expansion of macro ‘__gl_error_call1’
  429 |      ? __gl_error_call1 (function, status, __VA_ARGS__)         \
      |        ^~~~~~~~~~~~~~~~
../gllib/error.h:572:4: note: in expansion of macro ‘__gl_error_call’
  572 |    __gl_error_call (verror, status, __VA_ARGS__)
      |    ^~~~~~~~~~~~~~~
../../gltests/test-verror.c:72:3: note: in expansion of macro ‘verror’
   72 |   verror (4, 0, format, args);
      |   ^~~~~~
../gllib/error.h:418:38: warning: left-hand operand of comma expression has no 
effect [-Wunused-value]
  418 |     ((function) (status, __VA_ARGS__), \
      |                                      ^
../gllib/error.h:433:10: note: in expansion of macro ‘__gl_error_call1’
  433 |          __gl_error_call1 (function, __errstatus, __VA_ARGS__); \
      |          ^~~~~~~~~~~~~~~~
../gllib/error.h:572:4: note: in expansion of macro ‘__gl_error_call’
  572 |    __gl_error_call (verror, status, __VA_ARGS__)
      |    ^~~~~~~~~~~~~~~
../../gltests/test-verror.c:72:3: note: in expansion of macro ‘verror’
   72 |   verror (4, 0, format, args);
      |   ^~~~~~
make[4]: *** [Makefile:4400: test-verror.o] Error 1


Bruno






reply via email to

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