Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
6e1cdb3d
Commit
6e1cdb3d
authored
Jan 04, 2011
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: NORETURN
parent
c89f34af
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
+22
-0
ccan/compiler/compiler.h
ccan/compiler/compiler.h
+18
-0
config.h
config.h
+1
-0
tools/configurator/configurator.c
tools/configurator/configurator.c
+3
-0
No files found.
ccan/compiler/compiler.h
View file @
6e1cdb3d
...
@@ -20,6 +20,24 @@
...
@@ -20,6 +20,24 @@
#define COLD
#define COLD
#endif
#endif
#if HAVE_ATTRIBUTE_NORETURN
/**
* NORETURN - a function does not return
*
* Used to mark a function which exits; useful for suppressing warnings.
*
* Example:
* static void NORETURN fail(const char *reason)
* {
* fprintf(stderr, "Error: %s (%s)\n", reason, strerror(errno));
* exit(1);
* }
*/
#define NORETURN __attribute__((noreturn))
#else
#define NORETURN
#endif
#if HAVE_ATTRIBUTE_PRINTF
#if HAVE_ATTRIBUTE_PRINTF
/**
/**
* PRINTF_FMT - a function takes printf-style arguments
* PRINTF_FMT - a function takes printf-style arguments
...
...
config.h
View file @
6e1cdb3d
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#define HAVE_ATTRIBUTE_COLD 1
#define HAVE_ATTRIBUTE_COLD 1
#define HAVE_ATTRIBUTE_CONST 1
#define HAVE_ATTRIBUTE_CONST 1
#define HAVE_ATTRIBUTE_MAY_ALIAS 1
#define HAVE_ATTRIBUTE_MAY_ALIAS 1
#define HAVE_ATTRIBUTE_NORETURN 1
#define HAVE_ATTRIBUTE_PRINTF 1
#define HAVE_ATTRIBUTE_PRINTF 1
#define HAVE_ATTRIBUTE_UNUSED 1
#define HAVE_ATTRIBUTE_UNUSED 1
#define HAVE_ATTRIBUTE_USED 1
#define HAVE_ATTRIBUTE_USED 1
...
...
tools/configurator/configurator.c
View file @
6e1cdb3d
...
@@ -44,6 +44,9 @@ static struct test tests[] = {
...
@@ -44,6 +44,9 @@ static struct test tests[] = {
"static int __attribute__((const)) func(int x) { return x; }"
},
"static int __attribute__((const)) func(int x) { return x; }"
},
{
"HAVE_ATTRIBUTE_MAY_ALIAS"
,
OUTSIDE_MAIN
,
NULL
,
{
"HAVE_ATTRIBUTE_MAY_ALIAS"
,
OUTSIDE_MAIN
,
NULL
,
"typedef short __attribute__((__may_alias__)) short_a;"
},
"typedef short __attribute__((__may_alias__)) short_a;"
},
{
"HAVE_ATTRIBUTE_NORETURN"
,
DEFINES_FUNC
,
NULL
,
"#include <stdlib.h>
\n
"
"static void __attribute__((noreturn)) func(int x) { exit(x); }"
},
{
"HAVE_ATTRIBUTE_PRINTF"
,
DEFINES_FUNC
,
NULL
,
{
"HAVE_ATTRIBUTE_PRINTF"
,
DEFINES_FUNC
,
NULL
,
"static void __attribute__((format(__printf__, 1, 2))) func(const char *fmt, ...) { }"
},
"static void __attribute__((format(__printf__, 1, 2))) func(const char *fmt, ...) { }"
},
{
"HAVE_ATTRIBUTE_UNUSED"
,
OUTSIDE_MAIN
,
NULL
,
{
"HAVE_ATTRIBUTE_UNUSED"
,
OUTSIDE_MAIN
,
NULL
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment