Warning: That file was not part of the compilation database. It may have many parsing errors.

1/* Derived from a test case in
2 https://sourceware.org/bugzilla/show_bug.cgi?id=1158. */
3#include <dlfcn.h>
4#include <stdlib.h>
5#include <stdio.h>
6#include <unistd.h>
7
8static int next = 3;
9
10static void
11f1 (void)
12{
13 puts ("f1");
14 if (next-- != 1)
15 _exit (1);
16}
17
18static void
19f2 (void)
20{
21 puts ("f2");
22 if (next-- != 2)
23 _exit (1);
24}
25
26static void
27f3 (void)
28{
29 puts ("f3");
30 if (next-- != 3)
31 _exit (1);
32}
33
34static int
35do_test (void)
36{
37 atexit (f1);
38
39 void *dso = dlopen ("$ORIGIN/bug-atexit2-lib.so", RTLD_NOW);
40 void (*fn) (void) = (void (*) (void)) dlsym (dso, "foo");
41 fn ();
42
43 atexit (f2);
44
45 dlclose (dso);
46
47 atexit (f3);
48
49 return 0;
50}
51
52#define TEST_FUNCTION do_test ()
53#include "../test-skeleton.c"
54

Warning: That file was not part of the compilation database. It may have many parsing errors.