1  /* Helper for getting proper name of overflow fallback function for
       2     {wc|st}{p|r|s}n{cat|cpy}
       3  
       4     All versions must be listed in ifunc-impl-list.c.
       5     Copyright (C) 2022-2023 Free Software Foundation, Inc.
       6     This file is part of the GNU C Library.
       7  
       8     The GNU C Library is free software; you can redistribute it and/or
       9     modify it under the terms of the GNU Lesser General Public
      10     License as published by the Free Software Foundation; either
      11     version 2.1 of the License, or (at your option) any later version.
      12  
      13     The GNU C Library is distributed in the hope that it will be useful,
      14     but WITHOUT ANY WARRANTY; without even the implied warranty of
      15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      16     Lesser General Public License for more details.
      17  
      18     You should have received a copy of the GNU Lesser General Public
      19     License along with the GNU C Library; if not, see
      20     <https://www.gnu.org/licenses/>.  */
      21  
      22  #ifndef _STRNCPY_OR_CAT_OVERFLOW_DEF_H_
      23  #define _STRNCPY_OR_CAT_OVERFLOW_DEF_H_ 1
      24  
      25  #if defined USE_MULTIARCH && IS_IN(libc)
      26  #  define UNDERSCORES __
      27  #  ifdef USE_WITH_SSE2
      28  #    define ISA_EXT _sse2
      29  #  elif defined USE_WITH_AVX2
      30  #    ifdef USE_WITH_RTM
      31  #      define ISA_EXT _avx2_rtm
      32  #    else
      33  #      define ISA_EXT _avx2
      34  #    endif
      35  
      36  #  elif defined USE_WITH_EVEX256
      37  #    define ISA_EXT _evex
      38  #  elif defined USE_WITH_EVEX512
      39  #    define ISA_EXT _evex512
      40  #  endif
      41  #else
      42  #  define UNDERSCORES
      43  #  define ISA_EXT
      44  #endif
      45  
      46  #ifdef USE_AS_WCSCPY
      47  #  define STRCPY_PREFIX wc
      48  #  define STRCAT_PREFIX wcs
      49  #  ifdef USE_AS_STPCPY
      50  #    define STRCPY_POSTFIX pcpy
      51  #  else
      52  #    define STRCPY_POSTFIX scpy
      53  #  endif
      54  #else
      55  #  define STRCPY_PREFIX st
      56  #  define STRCAT_PREFIX str
      57  #  ifdef USE_AS_STPCPY
      58  #    define STRCPY_POSTFIX pcpy
      59  #  else
      60  #    define STRCPY_POSTFIX rcpy
      61  #  endif
      62  #endif
      63  #define STRCAT_POSTFIX cat
      64  
      65  #define PRIMITIVE_OF_NAMER(underscores, prefix, postfix, ext)                 \
      66    underscores##prefix##postfix##ext
      67  
      68  #define OF_NAMER(...) PRIMITIVE_OF_NAMER (__VA_ARGS__)
      69  
      70  #ifndef OVERFLOW_STRCPY
      71  #  define OVERFLOW_STRCPY                                                     \
      72      OF_NAMER (UNDERSCORES, STRCPY_PREFIX, STRCPY_POSTFIX, ISA_EXT)
      73  #endif
      74  
      75  #ifndef OVERFLOW_STRCAT
      76  #  define OVERFLOW_STRCAT                                                     \
      77      OF_NAMER (UNDERSCORES, STRCAT_PREFIX, STRCAT_POSTFIX, ISA_EXT)
      78  #endif
      79  
      80  #endif