glibc/time
Adhemerval Zanella db7dbeed8d Handle clang -Wignored-attributes on weak aliases
Clang issues a warning for double alias redirection, indicating that thei
original symbol is used even if a weak definition attempts to override it.

For instance, in the construction:

  int __internal_impl (...) {}
  weak_alias (__internal_impl, external_impl);
  #if SOMETHING
  weak_alias (external_impl, another_external_impl)
  #endif

Clang warns that another_external_impl always resolves to __internal_impl,
even if external_impl is a weak reference. Using the internal symbol for
both aliases resolves this warning.

This issue also occurs with certain libc_hidden_def usage:

  int __internal_impl (...) {}
  weak_alias (__internal_impl, __internal_alias)
  libc_hidden_weak (__internal_alias)

In this case, using a strong_alias is sufficient to avoid the warning
(since the alias is internal, there is no need to use a weak alias).

However, for the constructions like:

  int __internal_impl (...) {}
  weak_alias (__internal_impl, __internal_alias)
  libc_hidden_def (__internal_alias)
  weak_alias (__internal_impl, external_alias)
  libc_hidden_def (external_alias)

Clang warns that the internal external_alias will always resolve to
__GI___internal_impl eve if a weak definition to __GI_internal_impl is
overriden.  For this case, a new macro named static_weak_alias is used
to create a strong alias for SHARED, or a weak_alias otherwise.

With these changes, there is no need to check and enable the
-Wno-ignored-attributes suppression when using clang.
2025-11-20 14:34:26 -03:00
..
bits/types
sys
Depend
Makefile Handle clang -Wignored-attributes on weak aliases 2025-11-20 14:34:26 -03:00
Versions
adjtime.c
alt_digit.c
asctime.c
bug-asctime.c
bug-asctime_r.c
bug-getdate1.c
bug-mktime1.c
bug-mktime4.c
clock.c
clock_getcpuclockid.c
clock_getres.c
clock_gettime.c
clock_nanosleep.c
clock_settime.c
clocktest.c
ctime.c
ctime_r.c
difftime.c
dysize.c
era.c
ftime.c
getdate.c
getitimer.c
gettimeofday.c
gmtime.c
lc-time-cleanup.c
localtime.c
mktime-internal.h
mktime.c Handle clang -Wignored-attributes on weak aliases 2025-11-20 14:34:26 -03:00
offtime.c
setitimer.c
settimeofday.c
settimezone.c
stime.c
strftime.c
strftime_l.c Cleanup some recently added whitespace. 2025-10-30 18:56:58 -07:00
strptime.c
strptime_l.c Cleanup some recently added whitespace. 2025-10-30 18:56:58 -07:00
test_time.c
time.c
time.h
timegm.c
timespec_get.c
timespec_getres.c
tst-adjtime-time64.c
tst-adjtime.c
tst-clock-time64.c
tst-clock.c
tst-clock2-time64.c
tst-clock2.c
tst-clock_gettime-time64.c
tst-clock_gettime.c
tst-clock_nanosleep-time64.c
tst-clock_nanosleep.c
tst-clock_settime-time64.c
tst-clock_settime.c
tst-cpuclock1-time64.c
tst-cpuclock1.c
tst-ctime-time64.c
tst-ctime.c
tst-difftime-time64.c
tst-difftime.c
tst-ftime.c
tst-ftime_l.c
tst-getdate.c
tst-gettimeofday-time64.c
tst-gettimeofday.c
tst-gmtime-time64.c
tst-gmtime.c
tst-itimer-time64.c
tst-itimer.c
tst-mktime.c
tst-mktime2.c
tst-mktime3.c
tst-mktime4-time64.c
tst-mktime4.c
tst-posixtz.c
tst-settimeofday-time64.c
tst-settimeofday.c
tst-strftime.c
tst-strftime2.c
tst-strftime3.c
tst-strftime4-time64.c
tst-strftime4.c
tst-strptime-whitespace.c
tst-strptime.c
tst-strptime2.c
tst-strptime3.c
tst-time-time64.c
tst-time.c
tst-timegm-time64.c
tst-timegm.c
tst-timespec_get-time64.c
tst-timespec_get.c
tst-timespec_getres-time64.c
tst-timespec_getres.c
tst-tzfile-fault.c
tst-tzname.c
tst-y2039-time64.c
tst-y2039.c
tst_wcsftime.c
tzfile.c
tzset.c
wcsftime.c
wcsftime_l.c