about summary refs log tree commit diff
path: root/assert
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright dates with scripts/update-copyrightsPaul Eggert2024-01-018-8/+8
|
* assert: Decorate error message bufferAdhemerval Zanella2023-11-071-0/+2
| | | | Reviewed-by: DJ Delorie <dj@redhat.com>
* tests: replace fgets by xfgetsFrederic Berat2023-06-132-6/+10
| | | | | | With fortification enabled, fgets calls return result needs to be checked, has it gets the __wur macro enabled. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* assert: Reformat Makefile.Carlos O'Donell2023-05-181-3/+14
| | | | | | | | Reflow all long lines adding comment terminators. Sort all reflowed text using scripts/sort-makefile-lines.py. No code generation changes observed in binary artifacts. No regressions on x86_64 and i686.
* Use __builtin_FILE instead of __FILE__ in assert in C++.Paul Pluzhnikov2023-02-101-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Likewise use __builtin_LINE instead of __LINE__. When building C++, inline functions are required to have the exact same sequence of tokens in every translation unit. But __FILE__ token, when used in a header file, does not necessarily expand to the exact same string literal, and that may cause compilation failure when C++ modules are being used. (It would also cause unpredictable output on assertion failure at runtime, but this rarely matters in practice.) For example, given the following sources: // a.h #include <assert.h> inline void fn () { assert (0); } // a.cc #include "a.h" // b.cc #include "foo/../a.h" preprocessing a.cc will yield a call to __assert_fail("0", "a.h", ...) but b.cc will yield __assert_fail("0", "foo/../a.h", ...)
* Update copyright dates with scripts/update-copyrightsJoseph Myers2023-01-068-8/+8
|
* Use atomic_exchange_release/acquireWilco Dijkstra2022-09-261-1/+1
| | | | | | | Rename atomic_exchange_rel/acq to use atomic_exchange_release/acquire since these map to the standard C11 atomic builtins. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Do not define static_assert or thread_local in headers for C2xJoseph Myers2022-09-071-1/+5
| | | | | | | | | | | | | | | | | | | | | C2x makes static_assert and thread_local into keywords, removing the definitions as macros in assert.h and threads.h. Thus, disable those macros in those glibc headers for C2x. The disabling is done based on a combination of language version and __GNUC_PREREQ, *not* based on __GLIBC_USE (ISOC2X), on the principle that users of the header (when requesting C11 or later APIs - not assert.h for C99 and older API versions) should always have the names static_assert or thread_local available after inclusion of the header, whether as a keyword or as a macro. Thus, when using a compiler without the keywords (whether an older compiler, possibly in C2x mode, or _GNU_SOURCE with any compiler but in an older language mode, for example) the macros should be defined, even when C2x APIs have been requested. The __GNUC_PREREQ conditionals here may well need updating with the versions of other compilers that gained support for these keywords in C2x mode. Tested for x86_64.
* assert: Do not use stderr in libc-internal assertFlorian Weimer2022-08-033-2/+39
| | | | | | | | | | | | | | | | | | | | Redirect internal assertion failures to __libc_assert_fail, based on based on __libc_message, which writes directly to STDERR_FILENO and calls abort. Also disable message translation and reword the error message slightly (adjusting stdlib/tst-bz20544 accordingly). As a result of these changes, malloc no longer needs its own redefinition of __assert_fail. __libc_assert_fail needs to be stubbed out during rtld dependency analysis because the rtld rebuilds turn __libc_assert_fail into __assert_fail, which is unconditionally provided by elf/dl-minimal.c. This change is not possible for the public assert macro and its __assert_fail function because POSIX requires that the diagnostic is written to stderr. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Update copyright dates with scripts/update-copyrightsPaul Eggert2022-01-017-7/+7
| | | | | | | | | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 7061 files FOO. I then removed trailing white space from math/tgmath.h, support/tst-support-open-dev-null-range.c, and sysdeps/x86_64/multiarch/strlen-vec.S, to work around the following obscure pre-commit check failure diagnostics from Savannah. I don't know why I run into these diagnostics whereas others evidently do not. remote: *** 912-#endif remote: *** 913: remote: *** 914- remote: *** error: lines with trailing whitespace found ... remote: *** error: sysdeps/unix/sysv/linux/statx_cp.c: trailing lines
* Update copyright dates with scripts/update-copyrightsPaul Eggert2021-01-027-7/+7
| | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 6694 files FOO. I then removed trailing white space from benchtests/bench-pthread-locks.c and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this diagnostic from Savannah: remote: *** pre-commit check failed ... remote: *** error: lines with trailing whitespace found remote: error: hook declined to update refs/heads/master
* Update copyright dates with scripts/update-copyrights.Joseph Myers2020-01-017-7/+7
|
* Fix failure when CFLAGS contains -DNDEBUG (Bug 25251)Carlos O'Donell2019-12-101-0/+3
| | | | | | | | | | | | | | | | | | | Building tests with -DNDEBUG in CFLAGS, gcc 9.2.1 issues the following error: tst-assert-c++.cc: In function ‘int do_test()’: tst-assert-c++.cc:66:12: error: unused variable ‘value’ [-Werror=unused-variable] 66 | no_int value; | ^~~~~ tst-assert-c++.cc:71:18: error: unused variable ‘value’ [-Werror=unused-variable] 71 | bool_and_int value; | ^~~~~ The assert has been disabled by building glibc with CFLAGS, CXXFLAGS, and CPPFLAGS with -DNDEBUG which removes the assert and leaves the value unused. We never want the assert disabled because that's the point of the test, so we undefine NDEBUG before including assert.h to ensure that we get assert correctly defined.
* Prefer https to http for gnu.org and fsf.org URLsPaul Eggert2019-09-077-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
* Update copyright dates with scripts/update-copyrights.Joseph Myers2019-01-017-7/+7
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* Fix uninitialized variable in assert_perror (bug 22761)Andreas Schwab2018-02-051-1/+1
|
* Update copyright dates with scripts/update-copyrights.Joseph Myers2018-01-017-7/+7
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* Fix position of tests-unsupported definition in assert/Makefile.Joseph Myers2017-08-221-2/+2
| | | | | | | | | | | | | | | | | | tests-unsupported has to be defined before the inclusion of Rules in a subdirectory Makefile; otherwise it is ineffective. This patch fixes the ordering in assert/Makefile, where a recent test addition put tests-unsupported too late (resulting in build failures when the C++ compiler was missing or broken, and thereby showing up the unrelated bug 21987). Incidentally, I don't see why these tests depend on $(have-cxx-thread_local) rather than just a working C++ compiler. Tested in such a configuration (broken compiler/libstdc++) with build-many-glibcs.py. * assert/Makefile [$(have-cxx-thread_local)]: Move conditional variable definitions above inclusion of ../Rules.
* assert: Support types without operator== (int) [BZ #21972]Florian Weimer2017-08-214-7/+117
|
* assert: Suppress pedantic warning caused by statement expressionFlorian Weimer2017-08-111-3/+9
|
* Update copyright dates with scripts/update-copyrights.Joseph Myers2017-01-015-5/+5
|
* assert.h: allow gcc to detect assert(a = 1) errorsJim Meyering2016-12-181-4/+17
| | | | | | | | | | | | | | * assert/assert.h (assert): Rewrite assert's definition so that a s/==/=/ typo, e.g., assert(errno = ENOENT) is not hidden from gcc's -Wparentheses by assert-added parentheses. The new definition uses "if (expr) /* empty */; else __assert_fail...", so gcc -Wall will now detect that type of error in an assert, too. The __STRICT_ANSI__ disjunct is to make this work also with both -ansi and -pedantic, which would reject the use of ({...}). I would have preferred to use __extension__ to mark that, but doing so would mistakenly suppress warnings about any extension in the user-supplied "expr". E.g., "assert ( ({1;}) )" must continue to evoke a warning.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2016-01-045-5/+5
|
* Don't macro-expand failed assertion expression [BZ #18604]David Kastrup2015-11-031-1/+1
| | | | | | | [BZ #18604] * assert/assert.h (assert): Don't macro-expand failed assertion expression in error message. * malloc/malloc.c (assert): Likewise.
* Add ersatz _Static_assert on older C hostsPaul Eggert2015-02-071-1/+0
| | | | | * misc/sys/cdefs.h (_Static_assert): Define a substitute, if on a pre-C11 C platform that is not known to support _Static_assert.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2015-01-025-5/+5
|
* Remove redundant C locale settings.Joseph Myers2014-06-071-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Various glibc build / install / test code has C locale settings that are redundant with LC_ALL=C. LC_ALL takes precedence over LANG, so anywhere that sets LC_ALL=C (explicitly, or through it being in the default environment for running tests) does not need to set LANG=C. LC_ALL=C also takes precedence over LANGUAGE, since 2001-01-02 Ulrich Drepper <drepper@redhat.com> * intl/dcigettext.c (guess_category_value): Rewrite so that LANGUAGE value is ignored if the selected locale is the C locale. * intl/tst-gettext.c: Set locale for above change. * intl/tst-translit.c: Likewise. and so settings of LANGUAGE=C are also redundant when LC_ALL=C is set. One test also had LC_ALL=C in its -ENV setting, although it's part of the default environment used for tests. This patch removes the redundant settings. It removes a suggestion in install.texi of setting LANGUAGE=C LC_ALL=C for "make install"; the Makefile.in target "install" already sets LC_ALL_C so there's no need for the user to set it (and nor should there be any need for the user to set it). If some build machine tool used by "make install" uses a version of libintl predating that 2001 change, and the user has LANGUAGE set, the removal of LANGUAGE=C from the Makefile.in "install" rule could in principle affect the user's installation. However, I don't think we need to be concerned about pre-2001 build tools. Tested x86_64. * Makefile (install): Don't set LANGUAGE. * Makefile.in (install): Likewise. * assert/Makefile (test-assert-ENV): Remove variable. (test-assert-perr-ENV): Likewise. * elf/Makefile (neededtest4-ENV): Likewise. * iconvdata/Makefile ($(inst_gconvdir)/gconv-modules) [$(cross-compiling) = no]: Don't set LANGUAGE. * io/ftwtest-sh (LANG): Remove variable. * libio/Makefile (tst-widetext-ENV): Likewise. * manual/install.texi (Running make install): Don't refer to environment settings for make install. * INSTALL: Regenerated. * nptl/tst-tls6.sh: Don't set LANG. * posix/globtest.sh (LANG): Remove variable. * string/Makefile (tester-ENV): Likewise. (inl-tester-ENV): Likewise. (noinl-tester-ENV): Likewise. * sysdeps/s390/s390-64/Makefile ($(inst_gconvdir)/gconv-modules) [$(cross-compiling) = no]: Don't set LANGUAGE. * timezone/Makefile (build-testdata): Use $(built-program-cmd) without explicit environment settings. localedata/ChangeLog: * tst-fmon.sh: Don't set LANGUAGE. * tst-locale.sh: Likewise.
* Consistently include Makeconfig after defining subdir.Joseph Myers2014-02-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In <https://sourceware.org/ml/libc-alpha/2014-01/msg00196.html> I noted it was necessary to add includes of Makeconfig early in various subdirectory makefiles for the tests-special variable settings added by that patch to be conditional on configuration information. No-one commented on the general question there of whether Makeconfig should always be included immediately after the definition of subdir. This patch implements that early inclusion of Makeconfig in each directory (which is a lot easier than consistent placement of includes of Rules). Includes are added if needed, or moved up if already present. Subdirectory "all:" targets are removed, since Makeconfig provides one. There is potential for further cleanups I haven't done. Rules and Makerules have code such as ifneq "$(findstring env,$(origin headers))" "" headers := endif to override to empty any value of various variables that came from the environment. I think there is a case for Makeconfig setting all the subdirectory variables (other than subdir) to empty to ensure no outside value is going to take effect if a subdirectory fails to define a variable. (A list of such variables, possibly out of date and incomplete, is in manual/maint.texi.) Rules and Makerules would give errors if Makeconfig hadn't already been included, instead of including it themselves. The special code to override values coming from the environment would then be obsolete and could be removed. Tested x86_64, including that installed binaries are identical before and after the patch. * argp/Makefile: Include Makeconfig immediately after defining subdir. * assert/Makefile: Likewise. * benchtests/Makefile: Likewise. * catgets/Makefile: Likewise. * conform/Makefile: Likewise. * crypt/Makefile: Likewise. * csu/Makefile: Likewise. (all): Remove target. * ctype/Makefile: Include Makeconfig immediately after defining subdir. * debug/Makefile: Likewise. * dirent/Makefile: Likewise. * dlfcn/Makefile: Likewise. * gmon/Makefile: Likewise. * gnulib/Makefile: Likewise. * grp/Makefile: Likewise. * gshadow/Makefile: Likewise. * hesiod/Makefile: Likewise. * hurd/Makefile: Likewise. (all): Remove target. * iconvdata/Makefile: Include Makeconfig immediately after defining subdir. * inet/Makefile: Likewise. * intl/Makefile: Likewise. * io/Makefile: Likewise. * libio/Makefile: Likewise. (all): Remove target. * locale/Makefile: Include Makeconfig immediately after defining subdir. * login/Makefile: Likewise. * mach/Makefile: Likewise. (all): Remove target. * malloc/Makefile: Include Makeconfig immediately after defining subdir. (all): Remove target. * manual/Makefile: Include Makeconfig immediately after defining subdir. * math/Makefile: Likewise. * misc/Makefile: Likewise. * nis/Makefile: Likewise. * nss/Makefile: Likewise. * po/Makefile: Likewise. (all): Remove target. * posix/Makefile: Include Makeconfig immediately after defining subdir. * pwd/Makefile: Likewise. * resolv/Makefile: Likewise. * resource/Makefile: Likewise. * rt/Makefile: Likewise. * setjmp/Makefile: Likewise. * shadow/Makefile: Likewise. * signal/Makefile: Likewise. * socket/Makefile: Likewise. * soft-fp/Makefile: Likewise. * stdio-common/Makefile: Likewise. * stdlib/Makefile: Likewise. * streams/Makefile: Likewise. * string/Makefile: Likewise. * sunrpc/Makefile: Likewise. (all): Remove target. * sysvipc/Makefile: Include Makeconfig immediately after defining subdir. * termios/Makefile: Likewise. * time/Makefile: Likewise. * timezone/Makefile: Likewise. (all): Remove target. * wcsmbs/Makefile: Include Makeconfig immediately after defining subdir. * wctype/Makefile: Likewise. libidn/ChangeLog: * Makefile: Include Makeconfig immediately after defining subdir. localedata/ChangeLog: * Makefile: Include Makeconfig immediately after defining subdir. (all): Remove target. nptl/ChangeLog: * Makefile: Include Makeconfig immediately after defining subdir. nptl_db/ChangeLog: * Makefile: Include Makeconfig immediately after defining subdir.
* Use glibc_likely instead __builtin_expect.Ondřej Bílka2014-02-101-1/+1
|
* Update copyright notices with scripts/update-copyrightsAllan McRae2014-01-015-5/+5
|
* Update copyright notices with scripts/update-copyrights.Joseph Myers2013-01-025-7/+5
|
* Remove use of INTDEF/INTUSE in libioAndreas Schwab2012-05-241-3/+2
|
* Replace FSF snail mail address with URLs.Paul Eggert2012-02-095-15/+10
|
* Remove pre-ISO C supportUlrich Drepper2012-01-071-6/+5
| | | | No more __const.
* Fix C11 header changes for C++.Joseph Myers2012-01-061-2/+2
|
* Define static_assertUlrich Drepper2012-01-011-1/+8
|
* Cleanup of configuration optionsUlrich Drepper2011-09-101-5/+3
| | | | Make several tool features mandatory and simplify the code.
* Use mmap for allocation of buffers used for __abort_msgUlrich Drepper2011-05-152-61/+44
|
* Preserve message printed before abort.Ulrich Drepper2009-06-152-8/+13
| | | | | | | The terminal output etc is not visible in a core file. The new libc-internal variable __abort_msg will point to a string with the message which has been printed before the abort in case abort is called from inside libc. BZ #10217
* Remove redundant .gitignore files.Andreas Schwab2009-05-161-6/+0
|
* rename each .cvsignore file to .gitignoreJim Meyering2009-05-151-0/+0
|
* [BZ #3991]Ulrich Drepper2007-02-161-5/+4
| | | | | | * assert/assert.h (assert): Simplify. (assert_perror): Likewise. Patch by Israel G. Lugo <ilugo@bridonsecurity.com>.
* Move cast to void inside ?: to quiet gcc.Ulrich Drepper2006-08-031-8/+10
|
* * include/stdio.h (__fxprintf): Remove wfmt argument.Ulrich Drepper2005-07-202-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stdio-common/fxprintf.c: Include assert.h, ctype.h and wchar.h. (__fxprintf): Remove wfmt argument, create wfmt format string on the fly from fmt. * argp/argp-fmtstream.c: Adjust all __fxprintf callers. * argp/argp-help.c: Likewise. * assert/assert-perr.c: Likewise. * assert/assert.c: Likewise. * gmon/gmon.c: Likewise. * inet/rcmd.c: Likewise. * malloc/obstack.c: Likewise. * misc/error.c: Likewise. * misc/getpass.c: Likewise. * posix/getopt.c: Likewise. * resolv/res_hconf.c: Likewise. * stdio-common/perror.c: Likewise. * stdio-common/psignal.c: Likewise. * stdlib/fmtmsg.c: Likewise. * sunrpc/auth_unix.c: Likewise. * sunrpc/clnt_perr.c: Likewise. * sunrpc/clnt_tcp.c: Likewise. * sunrpc/clnt_udp.c: Likewise. * sunrpc/clnt_unix.c: Likewise. * sunrpc/svc_simple.c: Likewise. * sunrpc/svc_tcp.c: Likewise. * sunrpc/svc_udp.c: Likewise. * sunrpc/svc_unix.c: Likewise. * sunrpc/xdr.c: Likewise. * sunrpc/xdr_array.c: Likewise. * sunrpc/xdr_rec.c: Likewise. * sunrpc/xdr_ref.c: Likewise. * sysdeps/generic/wordexp.c: Likewise.
* * wcsmbs/bits/wchar2.h: Add definitions for wcrtomb, mbsrtowcs,Ulrich Drepper2005-07-202-16/+5
| | | | | | | | | | | | | | | | wcsrtombs, mbsnrtowcs, and wcsnrtombs. * debug/Makefile (routines): Add wcrtomb_chk, mbsrtowcs_chk, wcsrtombs_chk, mbsnrtowcs_chk, and wcsnrtombs_chk. * debug/Versions: Add __wcrtomb_chk, __mbsrtowcs_chk, __wcsrtombs_chk, __mbsnrtowcs_chk, and __wcsnrtombs_chk. * debug/tst-chk1.c: Add tests for new functions. * debug/mbsnrtowcs_chk.c: New file. * debug/mbsrtowcs_chk.c: New file. * debug/wcrtomb_chk.c: New file. * debug/wcsnrtombs_chk.c: New file. * debug/wcsrtombs_chk.c: New file. * include/stdio.h: Add declaration for __fxprintf.
* (CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.Ulrich Drepper2004-12-223-15/+24
|
* 2.5-18.1Jakub Jelinek2007-07-123-24/+15
|
* Update.Ulrich Drepper2004-10-041-20/+3
| | | | * assert/assert.h: Give up on using __builtin_expect.
* Update.Ulrich Drepper2003-08-151-2/+2
| | | | | | | 2003-08-15 Jakub Jelinek <jakub@redhat.com> * assert/assert.h (assert_perror): Use __builtin_expect for gcc >= 3.0, not for !gcc or gcc < 3.0.
* Update.Ulrich Drepper2003-08-141-1/+1
| | | | | * assert/assert.h (assert): Use !! in front of expression to allow use of pointers.