summaryrefslogtreecommitdiff
path: root/mcon/U/d_regparm.U
blob: 7b968a1ad3e6ea4f2a91f5a1564fd9ee7dce68a4 (plain)
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
?RCS: $Id: d_regparm.U 167 2013-05-08 17:58:00Z rmanfredi $
?RCS:
?RCS: Copyright (c) 2006, Christian Biere
?RCS:
?RCS: You may redistribute only under the terms of the Artistic License,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic License; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
?MAKE:d_regparm: Myread Setvar cat rm cc ccflags ldflags gccversion
?MAKE:	-pick add $@ %<
?S:d_regparm:
?S:	This variable conditionally defines the HAS_REGPARM symbol, which
?S:	indicates to the C program that attribute regparm is available.
?S:.
?C:HAS_REGPARM:
?C:	This symbol is defined when __attribute__((__regparm__(n))) can be used.
?C:.
?H:#$d_regparm HAS_REGPARM
?H:.
?LINT:set d_regparm
: check whether '__attribute__((__regparm__(n)))' can be used
val="$undef"
if [ "x$gccversion" != x ]
then
	$cat >try.c <<'EOC'
static __attribute__((__regparm__(1))) int
blah(int x)
{
	return x / 2;
}
int main(int argc, char *argv[])
{
	(void) argv;
	return blah(argc);
}
EOC
	if $cc $ccflags -Werror $ldflags -o try try.c >/dev/null 2>&1
	then
		val="$define"
	fi
	$rm -rf try try.*
fi

set d_regparm
eval $setvar