From 58548b9d689fb9bba67bdc5b59c8d2fa47f4f8ec Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 18 Oct 2022 17:00:07 +0200 Subject: 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 --- iconv/gconv.c | 2 -- iconv/gconv_cache.c | 5 ----- iconv/gconv_db.c | 15 --------------- iconv/gconv_dl.c | 2 -- iconv/gconv_trans.c | 2 -- iconv/skeleton.c | 2 -- 6 files changed, 28 deletions(-) (limited to 'iconv') diff --git a/iconv/gconv.c b/iconv/gconv.c index dea9c80..592a759 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 5dbf596..8d47545 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 90037fd..4943c95 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 c93c5dd..5ed9826 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 0f4ce10..2255531 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 42ee0b6..9eaf9a4 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 -- cgit v1.1