summaryrefslogtreecommitdiffstats
path: root/share/tests/a2i.h/a2sl/a2sl_nobuild.sh
blob: 8a7bb4487d7bd92a90eb4af3e7f2bb286cb07ab2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/bash
# Copyright 2024 Alejandro Colomar <alx@kernel.org>
# SPDX-License-Identifier: LGPL-3.0-or-later WITH LGPL-3.0-linking-exception


set -Eeuf;


out="$(mktemp)";
CFLAGS="$CFLAGS -Werror";
CFLAGS="$CFLAGS $(pkgconf --cflags liba2i)";
LIBS="$(pkgconf --libs liba2i)";


$CC $CFLAGS -o "$out" -x c - $LIBS 2>&1 <<__EOF__ \
| if ! grep -- '-Werror=pointer-sign' >/dev/null; then \
	>&2 printf '%s\n' "$0:$LINENO: Expected [-Werror=pointer-sign]"; \
	exit 1; \
else \
	true; \
fi;
	#include <a2i/a2i.h>

	int
	main(void)
	{
		unsigned long  n;

		a2sl(&n, "0", NULL, 0, 0, 0);
	}
__EOF__


$CC $CFLAGS -o "$out" -x c - $LIBS 2>&1 <<__EOF__ \
| if ! grep -- 'incompatible-pointer-types' >/dev/null; then \
	>&2 printf '%s\n' "$0:$LINENO: Expected [incompatible-pointer-types]"; \
	exit 1; \
else \
	true; \
fi;
	#include <a2i/a2i.h>

	int
	main(void)
	{
		int  n;

		a2sl(&n, "0", NULL, 0, 0, 0);
	}
__EOF__