1 ?RCS: $Id: d_attribut.U,v 3.0.1.3 1995/01/30 14:33:45 ram Exp $
3 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 3.0.
11 ?RCS: Original Author: Andy Dougherty <doughera@lafcol.lafayette.edu>
13 ?RCS: $Log: d_attribut.U,v $
14 ?RCS: Revision 3.0.1.3 1995/01/30 14:33:45 ram
15 ?RCS: patch49: test C program now includes <stdio.h> (WED)
17 ?RCS: Revision 3.0.1.2 1995/01/11 15:25:47 ram
18 ?RCS: patch45: fixed typo in the d_attribut variable (ADO)
20 ?RCS: Revision 3.0.1.1 1994/10/29 16:08:55 ram
21 ?RCS: patch36: created by ADO
23 ?MAKE:d_attribute_format d_attribute_malloc d_attribute_nonnull d_attribute_noreturn d_attribute_pure d_attribute_unused d_attribute_warn_unused_result: Myread Oldconfig cat cc ccflags rm Setvar contains
24 ?MAKE: -pick add $@ %<
25 ?S:d_attribute_format (d_attribut_format.U):
26 ?S: This variable conditionally defines HASATTRIBUTE_FORMAT, which
27 ?S: indicates the C compiler can check for printf-like formats.
29 ?S:d_attribute_malloc (d_attribute_malloc.U):
30 ?S: This variable conditionally defines HASATTRIBUTE_MALLOC, which
31 ?S: indicates the C compiler can understand functions as having
32 ?S: malloc-like semantics.
34 ?S:d_attribute_nonnull (d_attribute_nonnull.U):
35 ?S: This variable conditionally defines HASATTRIBUTE_NONNULL, which
36 ?S: indicates that the C compiler can know that certain arguments
37 ?S: must not be NULL, and will check accordingly at compile time.
39 ?S:d_attribute_noreturn (d_attribute_noreturn.U):
40 ?S: This variable conditionally defines HASATTRIBUTE_NORETURN, which
41 ?S: indicates that the C compiler can know that certain functions
42 ?S: are guaranteed never to return.
44 ?S:d_attribute_pure (d_attribute_pure.U):
45 ?S: This variable conditionally defines HASATTRIBUTE_PURE, which
46 ?S: indicates that the C compiler can know that certain functions
47 ?S: are "pure" functions, meaning that they have no side effects, and
48 ?S: only rely on function input and/or global data for their results.
50 ?S:d_attribute_unused (d_attribute_unused.U):
51 ?S: This variable conditionally defines HASATTRIBUTE_UNUSED, which
52 ?S: indicates that the C compiler can know that certain variables
53 ?S: and arguments may not always be used, and to not throw warnings
54 ?S: if they don't get used.
56 ?S:d_attribute_warn_unused_result (d_attribute_warn_unused_result.U):
57 ?S: This variable conditionally defines
58 ?S: HASATTRIBUTE_WARN_UNUSED_RESULT, which indicates that the C
59 ?S: compiler can know that certain functions have a return values
60 ?S: that must not be ignored, such as malloc() or open().
62 ?C:HASATTRIBUTE_FORMAT ~ %< (GNUC_ATTRIBUTE_CHECK):
63 ?C: Can we handle GCC attribute for checking printf-style formats
65 ?C:HASATTRIBUTE_MALLOC:
66 ?C: Can we handle GCC attribute for malloc-style functions.
68 ?C:HASATTRIBUTE_NONNULL:
69 ?C: Can we handle GCC attribute for nonnull function parms.
71 ?C:HASATTRIBUTE_NORETURN:
72 ?C: Can we handle GCC attribute for functions that do not return
75 ?C: Can we handle GCC attribute for pure functions
77 ?C:HASATTRIBUTE_UNUSED:
78 ?C: Can we handle GCC attribute for unused variables and arguments
80 ?C:HASATTRIBUTE_WARN_UNUSED_RESULT ~ %< (HASATTRIBUTE):
81 ?C: Can we handle GCC attribute for warning on unused results
83 ?H:?%<:#$d_attribute_format HASATTRIBUTE_FORMAT /**/
84 ?H:?%<:#$d_attribute_noreturn HASATTRIBUTE_NORETURN /**/
85 ?H:?%<:#$d_attribute_malloc HASATTRIBUTE_MALLOC /**/
86 ?H:?%<:#$d_attribute_nonnull HASATTRIBUTE_NONNULL /**/
87 ?H:?%<:#$d_attribute_pure HASATTRIBUTE_PURE /**/
88 ?H:?%<:#$d_attribute_unused HASATTRIBUTE_UNUSED /**/
89 ?H:?%<:#$d_attribute_warn_unused_result HASATTRIBUTE_WARN_UNUSED_RESULT /**/
91 ?LINT:set d_attribute_format
92 ?LINT:set d_attribute_malloc
93 ?LINT:set d_attribute_nonnull
94 ?LINT:set d_attribute_noreturn
95 ?LINT:set d_attribute_pure
96 ?LINT:set d_attribute_unused
97 ?LINT:set d_attribute_warn_unused_result
98 : Look for GCC-style attribute format
99 case "$d_attribute_format" in
102 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
103 $cat >attrib.c <<'EOCP'
105 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
107 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
108 if $contains 'warning' attrib.out >/dev/null 2>&1; then
109 echo "Your C compiler doesn't support __attribute__((format))."
112 echo "Your C compiler supports __attribute__((format))."
116 echo "Your C compiler doesn't seem to understand __attribute__ at all."
120 *) val="$d_attribute_format" ;;
122 set d_attribute_format
126 : Look for GCC-style attribute malloc
127 case "$d_attribute_malloc" in
130 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
131 $cat >attrib.c <<'EOCP'
133 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
135 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
136 if $contains 'warning' attrib.out >/dev/null 2>&1; then
137 echo "Your C compiler doesn't support __attribute__((malloc))."
140 echo "Your C compiler supports __attribute__((malloc))."
144 echo "Your C compiler doesn't seem to understand __attribute__ at all."
148 *) val="$d_attribute_malloc" ;;
150 set d_attribute_malloc
154 : Look for GCC-style attribute nonnull
155 case "$d_attribute_nonnull" in
158 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
159 $cat >attrib.c <<'EOCP'
161 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
163 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
164 if $contains 'warning' attrib.out >/dev/null 2>&1; then
165 echo "Your C compiler doesn't support __attribute__((nonnull))."
168 echo "Your C compiler supports __attribute__((nonnull))."
172 echo "Your C compiler doesn't seem to understand __attribute__ at all."
176 *) val="$d_attribute_nonnull" ;;
178 set d_attribute_nonnull
182 : Look for GCC-style attribute noreturn
183 case "$d_attribute_noreturn" in
186 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
187 $cat >attrib.c <<'EOCP'
189 void fall_over_dead( void ) __attribute__((noreturn));
191 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
192 if $contains 'warning' attrib.out >/dev/null 2>&1; then
193 echo "Your C compiler doesn't support __attribute__((noreturn))."
196 echo "Your C compiler supports __attribute__((noreturn))."
200 echo "Your C compiler doesn't seem to understand __attribute__ at all."
204 *) val="$d_attribute_noreturn" ;;
206 set d_attribute_noreturn
210 : Look for GCC-style attribute pure
211 case "$d_attribute_pure" in
214 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
215 $cat >attrib.c <<'EOCP'
217 int square( int n ) __attribute__((pure));
219 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
220 if $contains 'warning' attrib.out >/dev/null 2>&1; then
221 echo "Your C compiler doesn't support __attribute__((pure))."
224 echo "Your C compiler supports __attribute__((pure))."
228 echo "Your C compiler doesn't seem to understand __attribute__ at all."
232 *) val="$d_attribute_pure" ;;
238 : Look for GCC-style attribute unused
239 case "$d_attribute_unused" in
242 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
243 $cat >attrib.c <<'EOCP'
245 int do_something( int dummy __attribute__((unused)), int n );
247 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
248 if $contains 'warning' attrib.out >/dev/null 2>&1; then
249 echo "Your C compiler doesn't support __attribute__((unused))."
252 echo "Your C compiler supports __attribute__((unused))."
256 echo "Your C compiler doesn't seem to understand __attribute__ at all."
260 *) val="$d_attribute_unused" ;;
262 set d_attribute_unused
266 : Look for GCC-style attribute warn_unused_result
267 case "$d_attribute_warn_unused_result" in
270 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
271 $cat >attrib.c <<'EOCP'
273 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
275 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
276 if $contains 'warning' attrib.out >/dev/null 2>&1; then
277 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
280 echo "Your C compiler supports __attribute__((warn_unused_result))."
284 echo "Your C compiler doesn't seem to understand __attribute__ at all."
288 *) val="$d_attribute_warn_unused_result" ;;
290 set d_attribute_warn_unused_result