[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/2] error: it’s cold
From: |
Paul Eggert |
Subject: |
[PATCH 1/2] error: it’s cold |
Date: |
Wed, 14 Aug 2024 18:04:59 -0700 |
This mimics what glibc is doing nowadays.
* lib/error.in.h (error, error_at_line):
* lib/verror.h (verror, verror_at_line):
Declare with _GL_ATTRIBUTE_CODE.
---
ChangeLog | 8 ++++++++
lib/error.in.h | 12 ++++++++----
lib/verror.h | 4 +++-
3 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6e351bd70a..bd5e7b1ce5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-08-14 Paul Eggert <eggert@cs.ucla.edu>
+
+ error: it’s cold
+ This mimics what glibc is doing nowadays.
+ * lib/error.in.h (error, error_at_line):
+ * lib/verror.h (verror, verror_at_line):
+ Declare with _GL_ATTRIBUTE_CODE.
+
2024-08-14 Bruno Haible <bruno@clisp.org>
pthread-rwlock-extra-tests: Exclude this test from packages by default.
diff --git a/lib/error.in.h b/lib/error.in.h
index 4deaf98ded..d2aede7d53 100644
--- a/lib/error.in.h
+++ b/lib/error.in.h
@@ -30,8 +30,8 @@
#ifndef _@GUARD_PREFIX@_ERROR_H
#define _@GUARD_PREFIX@_ERROR_H
-/* This file uses _GL_ATTRIBUTE_ALWAYS_INLINE, _GL_ATTRIBUTE_FORMAT,
- _GL_ATTRIBUTE_MAYBE_UNUSED. */
+/* This file uses _GL_ATTRIBUTE_ALWAYS_INLINE, _GL_ATTRIBUTE_COLD,
+ _GL_ATTRIBUTE_FORMAT, _GL_ATTRIBUTE_MAYBE_UNUSED. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
@@ -93,6 +93,7 @@ extern "C" {
# endif
_GL_FUNCDECL_RPL (error, void,
(int __status, int __errnum, const char *__format, ...),
+ _GL_ATTRIBUTE_COLD
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3,
4)));
_GL_CXXALIAS_RPL (error, void,
(int __status, int __errnum, const char *__format, ...));
@@ -105,6 +106,7 @@ _GL_CXXALIAS_RPL (error, void,
# if ! @HAVE_ERROR@
_GL_FUNCDECL_SYS (error, void,
(int __status, int __errnum, const char *__format, ...),
+ _GL_ATTRIBUTE_COLD
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3,
4)));
# endif
_GL_CXXALIAS_SYS (error, void,
@@ -117,7 +119,7 @@ _GL_CXXALIAS_SYS (error, void,
# pragma GCC diagnostic ignored "-Wattributes"
_GL_ATTRIBUTE_MAYBE_UNUSED
static void
-_GL_ATTRIBUTE_ALWAYS_INLINE
+_GL_ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_COLD
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3, 4))
_gl_inline_error (int __status, int __errnum, const char *__format, ...)
{
@@ -148,6 +150,7 @@ _GL_CXXALIASWARN (error);
_GL_FUNCDECL_RPL (error_at_line, void,
(int __status, int __errnum, const char *__filename,
unsigned int __lineno, const char *__format, ...),
+ _GL_ATTRIBUTE_COLD
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5,
6)));
_GL_CXXALIAS_RPL (error_at_line, void,
(int __status, int __errnum, const char *__filename,
@@ -162,6 +165,7 @@ _GL_CXXALIAS_RPL (error_at_line, void,
_GL_FUNCDECL_SYS (error_at_line, void,
(int __status, int __errnum, const char *__filename,
unsigned int __lineno, const char *__format, ...),
+ _GL_ATTRIBUTE_COLD
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5,
6)));
# endif
_GL_CXXALIAS_SYS (error_at_line, void,
@@ -175,7 +179,7 @@ _GL_CXXALIAS_SYS (error_at_line, void,
# pragma GCC diagnostic ignored "-Wattributes"
_GL_ATTRIBUTE_MAYBE_UNUSED
static void
-_GL_ATTRIBUTE_ALWAYS_INLINE
+_GL_ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_COLD
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5, 6))
_gl_inline_error_at_line (int __status, int __errnum, const char *__filename,
unsigned int __lineno, const char *__format, ...)
diff --git a/lib/verror.h b/lib/verror.h
index deeec966fd..a951a5c3e1 100644
--- a/lib/verror.h
+++ b/lib/verror.h
@@ -17,7 +17,7 @@
#ifndef _VERROR_H
#define _VERROR_H 1
-/* This file uses _GL_ATTRIBUTE_FORMAT. */
+/* This file uses _GL_ATTRIBUTE_COLD, _GL_ATTRIBUTE_FORMAT. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
@@ -39,6 +39,7 @@ extern "C" {
extern void verror (int __status, int __errnum, const char *__format,
va_list __args)
+ _GL_ATTRIBUTE_COLD
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 3, 0));
/* Print a message with 'vfprintf (stderr, FORMAT, ARGS)';
@@ -51,6 +52,7 @@ extern void verror (int __status, int __errnum, const char
*__format,
extern void verror_at_line (int __status, int __errnum, const char *__fname,
unsigned int __lineno, const char *__format,
va_list __args)
+ _GL_ATTRIBUTE_COLD
_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 5, 0));
#ifdef __cplusplus
--
2.46.0
- [PATCH 1/2] error: it’s cold,
Paul Eggert <=
- [PATCH 2/2] error: merge from glibc and with verror, Paul Eggert, 2024/08/14
- Re: [PATCH 2/2] error: merge from glibc and with verror, Bruno Haible, 2024/08/14
- Re: [PATCH 2/2] error: merge from glibc and with verror, Paul Eggert, 2024/08/14
- Re: [PATCH 2/2] error: merge from glibc and with verror, Bruno Haible, 2024/08/15
- Re: [PATCH 2/2] error: merge from glibc and with verror, Paul Eggert, 2024/08/15
- Re: [PATCH 2/2] error: merge from glibc and with verror, Bruno Haible, 2024/08/15
- Re: [PATCH 2/2] error: merge from glibc and with verror, Paul Eggert, 2024/08/15
- Re: [PATCH 2/2] error: merge from glibc and with verror, Bruno Haible, 2024/08/17
- Re: [PATCH 2/2] error: merge from glibc and with verror, Paul Eggert, 2024/08/17
Re: [PATCH 2/2] error: merge from glibc and with verror, Pádraig Brady, 2024/08/15