Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: fusl/src/exit/exit.c

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #include <stdlib.h> 1 #include <stdlib.h>
2 #include <stdint.h> 2 #include <stdint.h>
3 #include "libc.h" 3 #include "libc.h"
4 4
5 static void dummy() 5 static void dummy() {}
6 {
7 }
8 6
9 /* atexit.c and __stdio_exit.c override these. the latter is linked 7 /* atexit.c and __stdio_exit.c override these. the latter is linked
10 * as a consequence of linking either __toread.c or __towrite.c. */ 8 * as a consequence of linking either __toread.c or __towrite.c. */
11 weak_alias(dummy, __funcs_on_exit); 9 weak_alias(dummy, __funcs_on_exit);
12 weak_alias(dummy, __stdio_exit); 10 weak_alias(dummy, __stdio_exit);
13 weak_alias(dummy, _fini); 11 weak_alias(dummy, _fini);
14 12
15 __attribute__((__weak__, __visibility__("hidden"))) 13 __attribute__((__weak__, __visibility__("hidden"))) extern void (
16 extern void (*const __fini_array_start)(void), (*const __fini_array_end)(void); 14 *const __fini_array_start)(void),
15 (*const __fini_array_end)(void);
17 16
18 static void libc_exit_fini(void) 17 static void libc_exit_fini(void) {
19 { 18 uintptr_t a = (uintptr_t)&__fini_array_end;
20 » uintptr_t a = (uintptr_t)&__fini_array_end; 19 for (; a > (uintptr_t)&__fini_array_start; a -= sizeof(void (*)()))
21 » for (; a>(uintptr_t)&__fini_array_start; a-=sizeof(void(*)())) 20 (*(void (**)())(a - sizeof(void (*)())))();
22 » » (*(void (**)())(a-sizeof(void(*)())))(); 21 _fini();
23 » _fini();
24 } 22 }
25 23
26 weak_alias(libc_exit_fini, __libc_exit_fini); 24 weak_alias(libc_exit_fini, __libc_exit_fini);
27 25
28 _Noreturn void exit(int code) 26 _Noreturn void exit(int code) {
29 { 27 __funcs_on_exit();
30 » __funcs_on_exit(); 28 __libc_exit_fini();
31 » __libc_exit_fini(); 29 __stdio_exit();
32 » __stdio_exit(); 30 _Exit(code);
33 » _Exit(code);
34 } 31 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698