system/Error: add [[gnu::const]] attribute

This commit is contained in:
Max Kellermann 2022-06-13 21:16:07 +02:00
parent 45d908e25f
commit acfeec7a5d
1 changed files with 3 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2013-2015 Max Kellermann <max.kellermann@gmail.com> * Copyright 2013-2022 Max Kellermann <max.kellermann@gmail.com>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@ -27,8 +27,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef SYSTEM_ERROR_HXX #pragma once
#define SYSTEM_ERROR_HXX
#include <system_error> // IWYU pragma: export #include <system_error> // IWYU pragma: export
#include <utility> #include <utility>
@ -104,6 +103,7 @@ FormatLastError(const char *fmt, Args&&... args) noexcept
* *
* @see https://stackoverflow.com/questions/28746372/system-error-categories-and-standard-system-error-codes * @see https://stackoverflow.com/questions/28746372/system-error-categories-and-standard-system-error-codes
*/ */
[[gnu::const]]
static inline const std::error_category & static inline const std::error_category &
ErrnoCategory() noexcept ErrnoCategory() noexcept
{ {
@ -203,5 +203,3 @@ IsAccessDenied(const std::system_error &e) noexcept
return IsErrno(e, EACCES); return IsErrno(e, EACCES);
#endif #endif
} }
#endif