Skip to content

Commit

Permalink
Merge pull request #1771 from ccoffing/noreturn
Browse files Browse the repository at this point in the history
[libc] exit,abort,longjmp are noreturn
  • Loading branch information
ghaerr authored Dec 10, 2023
2 parents e57248f + f61b3e0 commit 0cf9d6a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion libc/include/setjmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define __SETJMP_H

#include <features.h>
#include <stdnoreturn.h>

/*
* I know most systems use an array of ints here, but I prefer this - RDB
Expand All @@ -21,7 +22,7 @@ typedef struct
} jmp_buf[1];

int _setjmp(jmp_buf env);
void _longjmp(jmp_buf env, int rv);
noreturn void _longjmp(jmp_buf env, int rv);

/* LATER: Seems GNU beat me to it, must be OK then :-)
* Humm, what's this about setjmp being a macro !?
Expand Down
5 changes: 3 additions & 2 deletions libc/include/stdlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

/* stdlib.h <[email protected]> */
#include <features.h>
#include <stdnoreturn.h>
#include <sys/types.h>
#include <malloc.h>

Expand Down Expand Up @@ -52,9 +53,9 @@ char *getenv(const char *name);
int putenv(char *string);
char *mktemp(char *template);

void abort (void);
noreturn void abort (void);
int atexit (void (* function) ());
void exit (int status);
noreturn void exit (int status);
int system(const char *command);
void qsort(void *base, size_t nel, size_t width,
int (*compar)(/*const void *, const void * */));
Expand Down
3 changes: 2 additions & 1 deletion libc/include/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define __UNISTD_H

#include <features.h>
#include <stdnoreturn.h>
#include <sys/types.h>
#include <sys/select.h>

Expand Down Expand Up @@ -49,7 +50,7 @@ int execve(char *fname, char **argv, char **envp);
int execvp(char *fname, char **argv);
int execvpe(char *fname, char **argv, char **envp);
int _execve(char *fname, char *stk_ptr, int stack_bytes);
void _exit(int status);
noreturn void _exit(int status);
int isatty (int fd);
char *ttyname(int fd);
off_t lseek (int fildes, off_t offset, int whence);
Expand Down

0 comments on commit 0cf9d6a

Please sign in to comment.