Skip to content

Commit 435cf13

Browse files
committed
Fix typos and formatting in noreturn attribute description
Signed-off-by: Thomas Nyman <[email protected]>
1 parent df4158a commit 435cf13

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/Compiler-Hardening-Guides/Compiler-Annotations-for-C-and-C++.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,15 @@ void read_from_file (int fd, void *dst, size_t size) __attribute__ ((fd_arg_read
265265
266266
[^gcc-fd_arg]: GCC team, [Using the GNU Compiler Collection (GCC): 6.35.1 Common Function Attributes: fd_arg](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-fd_005farg-function-attribute), GCC Manual, 2024-08-01.
267267
268+
---
269+
268270
### Mark functions that never return
269271
270272
| Attribute | Supported since | Type | Description |
271273
|:-----------------------------------------------------------------------------------------------|:---------------------------:|:----------------------------:|:------------------------------------------------------------------------------------------------- |
272274
| `noreturn` | GCC 2.5.0<br/>Clang 4.0.0 | Function | Mark functions that never return. |
273275
274-
The `noreturn` attribute indicates that the annotation function never return control flow to the calling function (e.g. functions that terminate the application such as `abort()` and `exit()`, throw exceptions, loop indefinitely, etc.). Such functions and methods must be declared void.
276+
The `noreturn` attribute indicates that the annotated function never returns control flow to the calling function (e.g. functions that terminate the application such as `abort()` and `exit()`, throw exceptions, loop indefinitely, etc.). Such functions and methods must be declared void.
275277
276278
Using this attribute allows the compiler to optimize the generated code without regard to what would happen if the annotated function ever did return. In addition, compiler can generate a diagnostic for any function declared as `noreturn` that appears to return to its caller[^clang-noreturn] and `noreturn` functions can improve the accuracy of other diagnostics, e.g., by helping the compiler reduce false warnings for uninitialized variables[^gcc-noreturn].
277279

0 commit comments

Comments
 (0)