aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2022-10-18 17:00:07 +0200
committerFlorian Weimer <fweimer@redhat.com>2022-10-18 17:04:10 +0200
commit58548b9d689fb9bba67bdc5b59c8d2fa47f4f8ec (patch)
tree0aea307f4cf761952fbdf15fd67fc3b09b43707c
parent88f4b6929c26f9240a4b0b7dcc62922f02544a09 (diff)
downloadglibc-58548b9d689fb9bba67bdc5b59c8d2fa47f4f8ec.tar.xz
glibc-58548b9d689fb9bba67bdc5b59c8d2fa47f4f8ec.zip
Use PTR_MANGLE and PTR_DEMANGLE unconditionally in C sources
In the future, this will result in a compilation failure if the macros are unexpectedly undefined (due to header inclusion ordering or header inclusion missing altogether). Assembler sources are more difficult to convert. In many cases, they are hand-optimized for the mangling and no-mangling variants, which is why they are not converted. sysdeps/s390/s390-32/__longjmp.c and sysdeps/s390/s390-64/__longjmp.c are special: These are C sources, but most of the implementation is in assembler, so the PTR_DEMANGLE macro has to be undefined in some cases, to match the assembler style. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-rw-r--r--hurd/sigunwind.c2
-rw-r--r--iconv/gconv.c2
-rw-r--r--iconv/gconv_cache.c5
-rw-r--r--iconv/gconv_db.c15
-rw-r--r--iconv/gconv_dl.c2
-rw-r--r--iconv/gconv_trans.c2
-rw-r--r--iconv/skeleton.c2
-rw-r--r--inet/idna.c6
-rw-r--r--libio/iofopncook.c12
-rw-r--r--libio/iofwide.c6
-rw-r--r--libio/libioP.h2
-rw-r--r--libio/vtables.c2
-rw-r--r--misc/unwind-link.c10
-rw-r--r--nss/nss_module.c12
-rw-r--r--stdlib/cxa_atexit.c2
-rw-r--r--stdlib/cxa_finalize.c3
-rw-r--r--stdlib/cxa_thread_atexit_impl.c4
-rw-r--r--stdlib/exit.c9
-rw-r--r--stdlib/on_exit.c2
-rw-r--r--sysdeps/aarch64/jmpbuf-offsets.h2
-rw-r--r--sysdeps/alpha/jmpbuf-unwind.h2
-rw-r--r--sysdeps/arc/jmpbuf-unwind.h2
-rw-r--r--sysdeps/arm/jmpbuf-unwind.h2
-rw-r--r--sysdeps/csky/jmpbuf-unwind.h2
-rw-r--r--sysdeps/generic/unwind-link.h6
-rw-r--r--sysdeps/i386/jmpbuf-unwind.h2
-rw-r--r--sysdeps/i386/unwind-arch.h6
-rw-r--r--sysdeps/loongarch/jmpbuf-unwind.h2
-rw-r--r--sysdeps/m68k/jmpbuf-unwind.h2
-rw-r--r--sysdeps/mach/hurd/jmp-unwind.c2
-rw-r--r--sysdeps/microblaze/jmpbuf-unwind.h2
-rw-r--r--sysdeps/mips/jmpbuf-unwind.h2
-rw-r--r--sysdeps/nios2/jmpbuf-offsets.h2
-rw-r--r--sysdeps/powerpc/jmpbuf-unwind.h2
-rw-r--r--sysdeps/riscv/jmpbuf-unwind.h2
-rw-r--r--sysdeps/s390/jmpbuf-unwind.h2
-rw-r--r--sysdeps/s390/s390-32/__longjmp.c5
-rw-r--r--sysdeps/s390/s390-64/__longjmp.c5
-rw-r--r--sysdeps/sh/jmpbuf-unwind.h2
-rw-r--r--sysdeps/sparc/sparc32/jmpbuf-unwind.h2
-rw-r--r--sysdeps/x86_64/jmpbuf-unwind.h2
-rw-r--r--wcsmbs/btowc.c4
-rw-r--r--wcsmbs/mbrtoc16.c2
-rw-r--r--wcsmbs/mbrtowc.c2
-rw-r--r--wcsmbs/mbsnrtowcs.c2
-rw-r--r--wcsmbs/mbsrtowcs_l.c2
-rw-r--r--wcsmbs/wcrtomb.c2
-rw-r--r--wcsmbs/wcsnrtombs.c2
-rw-r--r--wcsmbs/wcsrtombs.c2
-rw-r--r--wcsmbs/wctob.c2
50 files changed, 20 insertions, 158 deletions
diff --git a/hurd/sigunwind.c b/hurd/sigunwind.c
index 28213091e3..f114990b6f 100644
--- a/hurd/sigunwind.c
+++ b/hurd/sigunwind.c
@@ -73,9 +73,7 @@ _hurdsig_longjmp_from_handler (void *data, jmp_buf env, int val)
inline uintptr_t demangle_ptr (uintptr_t x)
{
-# ifdef PTR_DEMANGLE
PTR_DEMANGLE (x);
-# endif
return x;
}
diff --git a/iconv/gconv.c b/iconv/gconv.c
index dea9c80fee..592a75956c 100644
--- a/iconv/gconv.c
+++ b/iconv/gconv.c
@@ -46,10 +46,8 @@ __gconv (__gconv_t cd, const unsigned char **inbuf,
cd->__data[last_step].__outbufend = outbufend;
__gconv_fct fct = cd->__steps->__fct;
-#ifdef PTR_DEMANGLE
if (cd->__steps->__shlib_handle != NULL)
PTR_DEMANGLE (fct);
-#endif
if (inbuf == NULL || *inbuf == NULL)
{
diff --git a/iconv/gconv_cache.c b/iconv/gconv_cache.c
index 5dbf596b8d..8d47545c41 100644
--- a/iconv/gconv_cache.c
+++ b/iconv/gconv_cache.c
@@ -205,16 +205,11 @@ find_module (const char *directory, const char *filename,
/* Call the init function. */
__gconv_init_fct init_fct = result->__init_fct;
-#ifdef PTR_DEMANGLE
PTR_DEMANGLE (init_fct);
-#endif
if (init_fct != NULL)
{
status = DL_CALL_FCT (init_fct, (result));
-
-#ifdef PTR_MANGLE
PTR_MANGLE (result->__btowc_fct);
-#endif
}
}
diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c
index 90037fdf58..4943c954a3 100644
--- a/iconv/gconv_db.c
+++ b/iconv/gconv_db.c
@@ -180,9 +180,7 @@ free_derivation (void *p)
&& deriv->steps[cnt].__shlib_handle != NULL)
{
__gconv_end_fct end_fct = deriv->steps[cnt].__end_fct;
-#ifdef PTR_DEMANGLE
PTR_DEMANGLE (end_fct);
-#endif
if (end_fct != NULL)
DL_CALL_FCT (end_fct, (&deriv->steps[cnt]));
}
@@ -208,9 +206,7 @@ __gconv_release_step (struct __gconv_step *step)
{
/* Call the destructor. */
__gconv_end_fct end_fct = step->__end_fct;
-#ifdef PTR_DEMANGLE
PTR_DEMANGLE (end_fct);
-#endif
if (end_fct != NULL)
DL_CALL_FCT (end_fct, (step));
@@ -303,9 +299,7 @@ gen_steps (struct derivation_step *best, const char *toset,
/* Call the init function. */
__gconv_init_fct init_fct = result[step_cnt].__init_fct;
-# ifdef PTR_DEMANGLE
PTR_DEMANGLE (init_fct);
-# endif
if (init_fct != NULL)
{
status = DL_CALL_FCT (init_fct, (&result[step_cnt]));
@@ -316,17 +310,13 @@ gen_steps (struct derivation_step *best, const char *toset,
/* Do not call the end function because the init
function has failed. */
result[step_cnt].__end_fct = NULL;
-# ifdef PTR_MANGLE
PTR_MANGLE (result[step_cnt].__end_fct);
-# endif
/* Make sure we unload this module. */
--step_cnt;
break;
}
}
-# ifdef PTR_MANGLE
PTR_MANGLE (result[step_cnt].__btowc_fct);
-# endif
}
else
#endif
@@ -404,15 +394,10 @@ increment_counter (struct __gconv_step *steps, size_t nsteps)
/* Call the init function. */
__gconv_init_fct init_fct = step->__init_fct;
-#ifdef PTR_DEMANGLE
PTR_DEMANGLE (init_fct);
-#endif
if (init_fct != NULL)
DL_CALL_FCT (init_fct, (step));
-
-#ifdef PTR_MANGLE
PTR_MANGLE (step->__btowc_fct);
-#endif
}
}
}
diff --git a/iconv/gconv_dl.c b/iconv/gconv_dl.c
index c93c5dd380..5ed982636a 100644
--- a/iconv/gconv_dl.c
+++ b/iconv/gconv_dl.c
@@ -127,11 +127,9 @@ __gconv_find_shlib (const char *name)
found->init_fct = __libc_dlsym (found->handle, "gconv_init");
found->end_fct = __libc_dlsym (found->handle, "gconv_end");
-#ifdef PTR_MANGLE
PTR_MANGLE (found->fct);
PTR_MANGLE (found->init_fct);
PTR_MANGLE (found->end_fct);
-#endif
/* We have succeeded in loading the shared object. */
found->counter = 1;
diff --git a/iconv/gconv_trans.c b/iconv/gconv_trans.c
index 0f4ce10996..2255531452 100644
--- a/iconv/gconv_trans.c
+++ b/iconv/gconv_trans.c
@@ -53,10 +53,8 @@ __gconv_transliterate (struct __gconv_step *step,
winbufend = (const uint32_t *) inbufend;
__gconv_fct fct = step->__fct;
-#ifdef PTR_DEMANGLE
if (step->__shlib_handle != NULL)
PTR_DEMANGLE (fct);
-#endif
/* If there is no transliteration information in the locale don't do
anything and return the error. */
diff --git a/iconv/skeleton.c b/iconv/skeleton.c
index 42ee0b6508..9eaf9a4948 100644
--- a/iconv/skeleton.c
+++ b/iconv/skeleton.c
@@ -404,10 +404,8 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
if ((data->__flags & __GCONV_IS_LAST) == 0)
{
fct = next_step->__fct;
-#ifdef PTR_DEMANGLE
if (next_step->__shlib_handle != NULL)
PTR_DEMANGLE (fct);
-#endif
}
/* If the function is called with no input this means we have to reset
diff --git a/inet/idna.c b/inet/idna.c
index df5811fd6a..2243d3e7d9 100644
--- a/inet/idna.c
+++ b/inet/idna.c
@@ -73,10 +73,8 @@ functions_allocate (void *closure)
result->handle = handle;
result->lookup_ul = ptr_lookup_ul;
result->to_unicode_lzlz = ptr_to_unicode_lzlz;
-#ifdef PTR_MANGLE
PTR_MANGLE (result->lookup_ul);
PTR_MANGLE (result->to_unicode_lzlz);
-#endif
return result;
}
@@ -138,9 +136,7 @@ __idna_to_dns_encoding (const char *name, char **result)
return EAI_IDN_ENCODE;
char *ptr = NULL;
__typeof__ (functions->lookup_ul) fptr = functions->lookup_ul;
-#ifdef PTR_DEMANGLE
PTR_DEMANGLE (fptr);
-#endif
int ret = fptr (name, &ptr, 0);
if (ret == 0)
{
@@ -165,9 +161,7 @@ __idna_from_dns_encoding (const char *name, char **result)
return gai_strdup (name, result);
char *ptr = NULL;
__typeof__ (functions->to_unicode_lzlz) fptr = functions->to_unicode_lzlz;
-#ifdef PTR_DEMANGLE
PTR_DEMANGLE (fptr);
-#endif
int ret = fptr (name, &ptr, 0);
if (ret == 0)
{
diff --git a/libio/iofopncook.c b/libio/iofopncook.c
index a7db4ef1c9..6c27610319 100644
--- a/libio/iofopncook.c
+++ b/libio/iofopncook.c
@@ -35,9 +35,7 @@ _IO_cookie_read (FILE *fp, void *buf, ssize_t size)
{
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
cookie_read_function_t *read_cb = cfile->__io_functions.read;
-#ifdef PTR_DEMANGLE
PTR_DEMANGLE (read_cb);
-#endif
if (read_cb == NULL)
return -1;
@@ -50,9 +48,7 @@ _IO_cookie_write (FILE *fp, const void *buf, ssize_t size)
{
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
cookie_write_function_t *write_cb = cfile->__io_functions.write;
-#ifdef PTR_DEMANGLE
PTR_DEMANGLE (write_cb);
-#endif
if (write_cb == NULL)
{
@@ -72,9 +68,7 @@ _IO_cookie_seek (FILE *fp, off64_t offset, int dir)
{
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
cookie_seek_function_t *seek_cb = cfile->__io_functions.seek;
-#ifdef PTR_DEMANGLE
PTR_DEMANGLE (seek_cb);
-#endif
return ((seek_cb == NULL
|| (seek_cb (cfile->__cookie, &offset, dir)
@@ -88,9 +82,7 @@ _IO_cookie_close (FILE *fp)
{
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
cookie_close_function_t *close_cb = cfile->__io_functions.close;
-#ifdef PTR_DEMANGLE
PTR_DEMANGLE (close_cb);
-#endif
if (close_cb == NULL)
return 0;
@@ -139,12 +131,10 @@ static void
set_callbacks (cookie_io_functions_t *target,
cookie_io_functions_t source)
{
-#ifdef PTR_MANGLE
PTR_MANGLE (source.read);
PTR_MANGLE (source.write);
PTR_MANGLE (source.seek);
PTR_MANGLE (source.close);
-#endif
*target = source;
}
@@ -226,9 +216,7 @@ _IO_old_cookie_seek (FILE *fp, off64_t offset, int dir)
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
int (*seek_cb) (FILE *, off_t, int)
= (int (*) (FILE *, off_t, int)) cfile->__io_functions.seek;
-#ifdef PTR_DEMANGLE
PTR_DEMANGLE (seek_cb);
-#endif
if (seek_cb == NULL)
return _IO_pos_BAD;
diff --git a/libio/iofwide.c b/libio/iofwide.c
index 1ce685f48a..37c353e3aa 100644
--- a/libio/iofwide.c
+++ b/libio/iofwide.c
@@ -124,10 +124,8 @@ __libio_codecvt_out (struct _IO_codecvt *codecvt, __mbstate_t *statep,
codecvt->__cd_out.step_data.__statep = statep;
__gconv_fct fct = gs->__fct;
-#ifdef PTR_DEMANGLE
if (gs->__shlib_handle != NULL)
PTR_DEMANGLE (fct);
-#endif
status = DL_CALL_FCT (fct,
(gs, &codecvt->__cd_out.step_data, &from_start_copy,
@@ -176,10 +174,8 @@ __libio_codecvt_in (struct _IO_codecvt *codecvt, __mbstate_t *statep,
codecvt->__cd_in.step_data.__statep = statep;
__gconv_fct fct = gs->__fct;
-#ifdef PTR_DEMANGLE
if (gs->__shlib_handle != NULL)
PTR_DEMANGLE (fct);
-#endif
status = DL_CALL_FCT (fct,
(gs, &codecvt->__cd_in.step_data, &from_start_copy,
@@ -243,10 +239,8 @@ __libio_codecvt_length (struct _IO_codecvt *codecvt, __mbstate_t *statep,
codecvt->__cd_in.step_data.__statep = statep;
__gconv_fct fct = gs->__fct;
-#ifdef PTR_DEMANGLE
if (gs->__shlib_handle != NULL)
PTR_DEMANGLE (fct);
-#endif
DL_CALL_FCT (fct,
(gs, &codecvt->__cd_in.step_data, &cp,
diff --git a/libio/libioP.h b/libio/libioP.h
index dac3de73a1..3a5498bd65 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -911,9 +911,7 @@ extern void (*IO_accept_foreign_vtables) (void) attribute_hidden;
static inline void
IO_set_accept_foreign_vtables (void (*flag) (void))
{
-#ifdef PTR_MANGLE
PTR_MANGLE (flag);
-#endif
atomic_store_relaxed (&IO_accept_foreign_vtables, flag);
}
diff --git a/libio/vtables.c b/libio/vtables.c
index 32459e4fac..e3809c28ce 100644
--- a/libio/vtables.c
+++ b/libio/vtables.c
@@ -39,9 +39,7 @@ _IO_vtable_check (void)
#ifdef SHARED
/* Honor the compatibility flag. */
void (*flag) (void) = atomic_load_relaxed (&IO_accept_foreign_vtables);
-#ifdef PTR_DEMANGLE
PTR_DEMANGLE (flag);
-#endif
if (flag == &_IO_vtable_check)
return;
diff --git a/misc/unwind-link.c b/misc/unwind-link.c
index 45b7886