mirror of
https://sourceware.org/git/glibc.git
synced 2026-10-28 10:25:13 +08:00
Commit a2b0ff98a0 added __attribute_optimization_barrier__ and converted the
users of __attribute__ ((noinline, noclone)) to it, so that Clang, which does
not implement noclone, gets optnone instead of an unknown-attribute warning
that is an error under -Werror.
Twelve users were missed, all of them in code that a plain x86_64 build never
preprocesses, which is why they survived the sweep:
- libio/tst-stderr-compat.c is inside
#if TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_1), so it is compiled only on
ports that still have GLIBC_2.0 compat symbols -- i686 and alpha among
them, but not x86_64. Building it with Clang fails.
- The eleven sysdeps/x86_64/x32/tst-size_t-*.c tests are built only for the
x32 ABI.
No functional change for GCC, which still gets noinline and noclone.
Checked that both shapes -- the weak function in libio and the static function
in the x32 tests -- compile with GCC and with Clang after the change, and that
the pre-change shape is an error under Clang with -Werror.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
53 lines
1.4 KiB
C
53 lines
1.4 KiB
C
/* Test that fclose works on stderr from glibc 2.0.
|
|
Copyright (C) 2024-2026 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; if not, see
|
|
<https://www.gnu.org/licenses/>. */
|
|
|
|
#include <shlib-compat.h>
|
|
|
|
#if TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
|
|
# define _LIBC
|
|
# define _IO_USE_OLD_IO_FILE
|
|
# include <stdio.h>
|
|
# include <support/check.h>
|
|
|
|
extern FILE _IO_stderr_;
|
|
compat_symbol_reference (libc, _IO_stderr_, _IO_stderr_, GLIBC_2_0);
|
|
compat_symbol_reference (libc, fclose, fclose, GLIBC_2_0);
|
|
|
|
__attribute__ ((weak)) __attribute_optimization_barrier__
|
|
void
|
|
do_fclose (FILE *fp)
|
|
{
|
|
TEST_VERIFY_EXIT (fclose (fp) == 0);
|
|
}
|
|
|
|
static int
|
|
do_test (void)
|
|
{
|
|
do_fclose (&_IO_stderr_);
|
|
return 0;
|
|
}
|
|
#else
|
|
static int
|
|
do_test (void)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
#include <support/test-driver.c>
|