This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
evat => eval as found by Tom Hukins
[metaconfig.git] / U / modified / d_attribut.U
1 ?RCS: $Id: d_attribut.U 1 2006-08-24 12:32:52Z rmanfredi $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
4 ?RCS:
5 ?RCS: You may redistribute only under the terms of the Artistic License,
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 License; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 3.0.
10 ?RCS:
11 ?RCS: Original Author: Andy Dougherty <doughera@lafcol.lafayette.edu>
12 ?RCS:
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)
16 ?RCS:
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)
19 ?RCS:
20 ?RCS: Revision 3.0.1.1  1994/10/29  16:08:55  ram
21 ?RCS: patch36: created by ADO
22 ?RCS:
23 ?MAKE:d_attribute_deprecated d_attribute_format d_attribute_malloc \
24         d_attribute_nonnull d_attribute_noreturn d_attribute_pure \
25         d_attribute_unused d_attribute_warn_unused_result \
26         d_printf_format_null: \
27             Myread Oldconfig cat cc ccflags rm Setvar contains i_stdlib run
28 ?MAKE:  -pick add $@ %<
29 ?S:d_attribute_format:
30 ?S:     This variable conditionally defines HASATTRIBUTE_FORMAT, which
31 ?S:     indicates the C compiler can check for printf-like formats.
32 ?S:.
33 ?S:d_attribute_deprecated:
34 ?S:     This variable conditionally defines HASATTRIBUTE_DEPRECATED, which
35 ?S:     indicates that GCC can handle the attribute for marking deprecated
36 ?S:     APIs
37 ?S:.
38 ?S:d_printf_format_null:
39 ?S:     This variable conditionally defines PRINTF_FORMAT_NULL_OK, which
40 ?S:     indicates the C compiler allows printf-like formats to be null.
41 ?S:.
42 ?S:d_attribute_malloc:
43 ?S:     This variable conditionally defines HASATTRIBUTE_MALLOC, which
44 ?S:     indicates the C compiler can understand functions as having
45 ?S:     malloc-like semantics.
46 ?S:.
47 ?S:d_attribute_nonnull:
48 ?S:     This variable conditionally defines HASATTRIBUTE_NONNULL, which
49 ?S:     indicates that the C compiler can know that certain arguments
50 ?S:     must not be NULL, and will check accordingly at compile time.
51 ?S:.
52 ?S:d_attribute_noreturn:
53 ?S:     This variable conditionally defines HASATTRIBUTE_NORETURN, which
54 ?S:     indicates that the C compiler can know that certain functions
55 ?S:     are guaranteed never to return.
56 ?S:.
57 ?S:d_attribute_pure:
58 ?S:     This variable conditionally defines HASATTRIBUTE_PURE, which
59 ?S:     indicates that the C compiler can know that certain functions
60 ?S:     are "pure" functions, meaning that they have no side effects, and
61 ?S:     only rely on function input and/or global data for their results.
62 ?S:.
63 ?S:d_attribute_unused:
64 ?S:     This variable conditionally defines HASATTRIBUTE_UNUSED, which
65 ?S:     indicates that the C compiler can know that certain variables
66 ?S:     and arguments may not always be used, and to not throw warnings
67 ?S:     if they don't get used.
68 ?S:.
69 ?S:d_attribute_warn_unused_result:
70 ?S:     This variable conditionally defines
71 ?S:     HASATTRIBUTE_WARN_UNUSED_RESULT, which indicates that the C
72 ?S:     compiler can know that certain functions have a return values
73 ?S:     that must not be ignored, such as malloc() or open().
74 ?S:.
75 ?C:HASATTRIBUTE_FORMAT ~ %< (GNUC_ATTRIBUTE_CHECK):
76 ?C:     Can we handle GCC attribute for checking printf-style formats
77 ?C:.
78 ?C:PRINTF_FORMAT_NULL_OK:
79 ?C:     Allows __printf__ format to be null when checking printf-style
80 ?C:.
81 ?C:HASATTRIBUTE_MALLOC:
82 ?C:     Can we handle GCC attribute for malloc-style functions.
83 ?C:.
84 ?C:HASATTRIBUTE_NONNULL:
85 ?C:     Can we handle GCC attribute for nonnull function parms.
86 ?C:.
87 ?C:HASATTRIBUTE_NORETURN:
88 ?C:     Can we handle GCC attribute for functions that do not return
89 ?C:.
90 ?C:HASATTRIBUTE_PURE:
91 ?C:     Can we handle GCC attribute for pure functions
92 ?C:.
93 ?C:HASATTRIBUTE_UNUSED:
94 ?C:     Can we handle GCC attribute for unused variables and arguments
95 ?C:.
96 ?C:HASATTRIBUTE_DEPRECATED:
97 ?C:     Can we handle GCC attribute for marking deprecated APIs
98 ?C:.
99 ?C:HASATTRIBUTE_WARN_UNUSED_RESULT ~ %< (HASATTRIBUTE):
100 ?C:     Can we handle GCC attribute for warning on unused results
101 ?C:.
102 ?H:?%<:#$d_attribute_deprecated HASATTRIBUTE_DEPRECATED /**/
103 ?H:?%<:#$d_attribute_format HASATTRIBUTE_FORMAT /**/
104 ?H:?%<:#$d_printf_format_null PRINTF_FORMAT_NULL_OK     /**/
105 ?H:?%<:#$d_attribute_noreturn HASATTRIBUTE_NORETURN     /**/
106 ?H:?%<:#$d_attribute_malloc HASATTRIBUTE_MALLOC /**/
107 ?H:?%<:#$d_attribute_nonnull HASATTRIBUTE_NONNULL       /**/
108 ?H:?%<:#$d_attribute_pure HASATTRIBUTE_PURE     /**/
109 ?H:?%<:#$d_attribute_unused HASATTRIBUTE_UNUSED /**/
110 ?H:?%<:#$d_attribute_warn_unused_result HASATTRIBUTE_WARN_UNUSED_RESULT /**/
111 ?H:.
112 ?F:!attrib !attrib.out !attrib.c
113 ?LINT:set d_attribute_deprecated
114 ?LINT:set d_attribute_format
115 ?LINT:set d_printf_format_null
116 ?LINT:set d_attribute_malloc
117 ?LINT:set d_attribute_nonnull
118 ?LINT:set d_attribute_noreturn
119 ?LINT:set d_attribute_pure
120 ?LINT:set d_attribute_unused
121 ?LINT:set d_attribute_warn_unused_result
122 : Look for GCC-style attribute format
123 case "$d_attribute_format" in
124 '')
125 echo " "
126 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
127 $cat >attrib.c <<'EOCP'
128 #include <stdio.h>
129 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
130 EOCP
131 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
132         if $contains 'warning' attrib.out >/dev/null 2>&1; then
133                 echo "Your C compiler doesn't support __attribute__((format))."
134                 val="$undef"
135         else
136                 echo "Your C compiler supports __attribute__((format))."
137                 val="$define"
138         fi
139 else
140         echo "Your C compiler doesn't seem to understand __attribute__ at all."
141         val="$undef"
142 fi
143 ;;
144 *) val="$d_attribute_format" ;;
145 esac
146 set d_attribute_format
147 eval $setvar
148 $rm -f attrib*
149
150 : Look for GCC-style attribute format with null format allowed
151 case "$d_printf_format_null" in
152 '') case "$d_attribute_format" in
153     $define)
154         echo " "
155         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
156 $cat >attrib.c <<EOCP
157 #include <stdio.h>
158 #$i_stdlib I_STDLIB
159 #ifdef I_STDLIB
160 #include <stdlib.h>
161 #endif
162 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
163 int null_printf (char* pat,...) { return (int)pat; }
164 int main () { exit(null_printf(NULL)); }
165 EOCP
166         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
167             : run the executable in case it produces a run-time warning
168             if $run ./attrib >>attrib.out 2>&1; then
169                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
170                     echo "Your C compiler doesn't allow __printf__ format to be null."
171                     val="$undef"
172                 else
173                     echo "Your C compiler allows __printf__ format to be null."
174                     val="$define"
175                 fi
176             else
177             echo "Your C compiler executable failed with __printf__ format null."
178             val="$undef"
179         fi
180     else
181         echo "Your C compiler fails with __printf__ format null."
182         val="$undef"
183     fi
184     ;;
185     *)  val="$undef" ;;
186     esac
187 ;;
188 *)  val="$d_printf_format_null" ;;
189 esac
190 set d_printf_format_null
191 eval $setvar
192 $rm -f attrib*
193
194 : Look for GCC-style attribute malloc
195 case "$d_attribute_malloc" in
196 '')
197 echo " "
198 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
199 $cat >attrib.c <<'EOCP'
200 #include <stdio.h>
201 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
202 EOCP
203 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
204         if $contains 'warning' attrib.out >/dev/null 2>&1; then
205                 echo "Your C compiler doesn't support __attribute__((malloc))."
206                 val="$undef"
207         else
208                 echo "Your C compiler supports __attribute__((malloc))."
209                 val="$define"
210         fi
211 else
212         echo "Your C compiler doesn't seem to understand __attribute__ at all."
213         val="$undef"
214 fi
215 ;;
216 *) val="$d_attribute_malloc" ;;
217 esac
218 set d_attribute_malloc
219 eval $setvar
220 $rm -f attrib*
221
222 : Look for GCC-style attribute nonnull
223 case "$d_attribute_nonnull" in
224 '')
225 echo " "
226 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
227 $cat >attrib.c <<'EOCP'
228 #include <stdio.h>
229 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
230 EOCP
231 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
232         if $contains 'warning' attrib.out >/dev/null 2>&1; then
233                 echo "Your C compiler doesn't support __attribute__((nonnull))."
234                 val="$undef"
235         else
236                 echo "Your C compiler supports __attribute__((nonnull))."
237                 val="$define"
238         fi
239 else
240         echo "Your C compiler doesn't seem to understand __attribute__ at all."
241         val="$undef"
242 fi
243 ;;
244 *) val="$d_attribute_nonnull" ;;
245 esac
246 set d_attribute_nonnull
247 eval $setvar
248 $rm -f attrib*
249
250 : Look for GCC-style attribute noreturn
251 case "$d_attribute_noreturn" in
252 '')
253 echo " "
254 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
255 $cat >attrib.c <<'EOCP'
256 #include <stdio.h>
257 void fall_over_dead( void ) __attribute__((noreturn));
258 EOCP
259 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
260         if $contains 'warning' attrib.out >/dev/null 2>&1; then
261                 echo "Your C compiler doesn't support __attribute__((noreturn))."
262                 val="$undef"
263         else
264                 echo "Your C compiler supports __attribute__((noreturn))."
265                 val="$define"
266         fi
267 else
268         echo "Your C compiler doesn't seem to understand __attribute__ at all."
269         val="$undef"
270 fi
271 ;;
272 *) val="$d_attribute_noreturn" ;;
273 esac
274 set d_attribute_noreturn
275 eval $setvar
276 $rm -f attrib*
277
278 : Look for GCC-style attribute pure
279 case "$d_attribute_pure" in
280 '')
281 echo " "
282 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
283 $cat >attrib.c <<'EOCP'
284 #include <stdio.h>
285 int square( int n ) __attribute__((pure));
286 EOCP
287 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
288         if $contains 'warning' attrib.out >/dev/null 2>&1; then
289                 echo "Your C compiler doesn't support __attribute__((pure))."
290                 val="$undef"
291         else
292                 echo "Your C compiler supports __attribute__((pure))."
293                 val="$define"
294         fi
295 else
296         echo "Your C compiler doesn't seem to understand __attribute__ at all."
297         val="$undef"
298 fi
299 ;;
300 *) val="$d_attribute_pure" ;;
301 esac
302 set d_attribute_pure
303 eval $setvar
304 $rm -f attrib*
305
306 : Look for GCC-style attribute unused
307 case "$d_attribute_unused" in
308 '')
309 echo " "
310 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
311 $cat >attrib.c <<'EOCP'
312 #include <stdio.h>
313 int do_something( int dummy __attribute__((unused)), int n );
314 EOCP
315 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
316         if $contains 'warning' attrib.out >/dev/null 2>&1; then
317                 echo "Your C compiler doesn't support __attribute__((unused))."
318                 val="$undef"
319         else
320                 echo "Your C compiler supports __attribute__((unused))."
321                 val="$define"
322         fi
323 else
324         echo "Your C compiler doesn't seem to understand __attribute__ at all."
325         val="$undef"
326 fi
327 ;;
328 *) val="$d_attribute_unused" ;;
329 esac
330 set d_attribute_unused
331 eval $setvar
332 $rm -f attrib*
333
334 : Look for GCC-style attribute deprecated
335 case "$d_attribute_deprecated" in
336 '')
337 echo " "
338 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
339 $cat >attrib.c <<'EOCP'
340 #include <stdio.h>
341 int I_am_deprecated(void) __attribute__((deprecated));
342 EOCP
343 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
344         if $contains 'warning' attrib.out >/dev/null 2>&1; then
345                 echo "Your C compiler doesn't support __attribute__((deprecated))."
346                 val="$undef"
347         else
348                 echo "Your C compiler supports __attribute__((deprecated))."
349                 val="$define"
350         fi
351 else
352         echo "Your C compiler doesn't seem to understand __attribute__ at all."
353         val="$undef"
354 fi
355 ;;
356 *) val="$d_attribute_deprecated" ;;
357 esac
358 set d_attribute_deprecated
359 eval $setvar
360 $rm -f attrib*
361
362 : Look for GCC-style attribute warn_unused_result
363 case "$d_attribute_warn_unused_result" in
364 '')
365 echo " "
366 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
367 $cat >attrib.c <<'EOCP'
368 #include <stdio.h>
369 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
370 EOCP
371 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
372         if $contains 'warning' attrib.out >/dev/null 2>&1; then
373                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
374                 val="$undef"
375         else
376                 echo "Your C compiler supports __attribute__((warn_unused_result))."
377                 val="$define"
378         fi
379 else
380         echo "Your C compiler doesn't seem to understand __attribute__ at all."
381         val="$undef"
382 fi
383 ;;
384 *) val="$d_attribute_warn_unused_result" ;;
385 esac
386 set d_attribute_warn_unused_result
387 eval $setvar
388 $rm -f attrib*
389