Skip to content

Commit 06623e0

Browse files
authored
Merge pull request Perl#61 from xenu/master
add probe for __attribute__(always_inline)
2 parents 1efb1ee + 829ae35 commit 06623e0

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

U/modified/d_attribut.U

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
?MAKE:d_attribute_deprecated d_attribute_format d_attribute_malloc \
2424
d_attribute_nonnull d_attribute_noreturn d_attribute_pure \
2525
d_attribute_unused d_attribute_warn_unused_result \
26-
d_printf_format_null: \
26+
d_printf_format_null d_attribute_always_inline: \
2727
Myread Oldconfig cat cc ccflags rm Setvar contains i_stdlib run \
2828
i_inttypes
2929
?MAKE: -pick add $@ %<
@@ -73,6 +73,11 @@
7373
?S: compiler can know that certain functions have a return values
7474
?S: that must not be ignored, such as malloc() or open().
7575
?S:.
76+
?S:d_attribute_always_inline:
77+
?S: This variable conditionally defines HASATTRIBUTE_ALWAYS_INLINE,
78+
?S: which indicates that the C compiler can know that certain
79+
?S: functions should always be inlined.
80+
?S:.
7681
?C:HASATTRIBUTE_FORMAT ~ %< (GNUC_ATTRIBUTE_CHECK):
7782
?C: Can we handle GCC attribute for checking printf-style formats
7883
?C:.
@@ -100,6 +105,10 @@
100105
?C:HASATTRIBUTE_WARN_UNUSED_RESULT ~ %< (HASATTRIBUTE):
101106
?C: Can we handle GCC attribute for warning on unused results
102107
?C:.
108+
?C:HASATTRIBUTE_ALWAYS_INLINE:
109+
?C: Can we handle GCC attribute for functions that should always be
110+
?C: inlined.
111+
?C:.
103112
?H:?%<:#$d_attribute_deprecated HASATTRIBUTE_DEPRECATED /**/
104113
?H:?%<:#$d_attribute_format HASATTRIBUTE_FORMAT /**/
105114
?H:?%<:#$d_printf_format_null PRINTF_FORMAT_NULL_OK /**/
@@ -109,6 +118,7 @@
109118
?H:?%<:#$d_attribute_pure HASATTRIBUTE_PURE /**/
110119
?H:?%<:#$d_attribute_unused HASATTRIBUTE_UNUSED /**/
111120
?H:?%<:#$d_attribute_warn_unused_result HASATTRIBUTE_WARN_UNUSED_RESULT /**/
121+
?H:?%<:#$d_attribute_always_inline HASATTRIBUTE_ALWAYS_INLINE /**/
112122
?H:.
113123
?F:!attrib !attrib.out !attrib.c
114124
?LINT:set d_attribute_deprecated
@@ -120,6 +130,7 @@
120130
?LINT:set d_attribute_pure
121131
?LINT:set d_attribute_unused
122132
?LINT:set d_attribute_warn_unused_result
133+
?LINT:set d_attribute_always_inline
123134
: Look for GCC-style attribute format
124135
case "$d_attribute_format" in
125136
'')
@@ -395,3 +406,31 @@ set d_attribute_warn_unused_result
395406
eval $setvar
396407
$rm -f attrib*
397408

409+
: Look for GCC-style attribute always_inline
410+
case "$d_attribute_always_inline" in
411+
'')
412+
echo " "
413+
echo "Checking whether your compiler can handle __attribute__((always_inline)) ..." >&4
414+
$cat >attrib.c <<'EOCP'
415+
#include <stdio.h>
416+
static __inline__ __attribute__((always_inline)) int I_will_always_be_inlined(void);
417+
EOCP
418+
if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
419+
if $contains 'warning' attrib.out >/dev/null 2>&1; then
420+
echo "Your C compiler doesn't support __attribute__((always_inline))."
421+
val="$undef"
422+
else
423+
echo "Your C compiler supports __attribute__((always_inline))."
424+
val="$define"
425+
fi
426+
else
427+
echo "Your C compiler doesn't seem to understand __attribute__ at all."
428+
val="$undef"
429+
fi
430+
;;
431+
*) val="$d_attribute_always_inline" ;;
432+
esac
433+
set d_attribute_always_inline
434+
eval $setvar
435+
$rm -f attrib*
436+

0 commit comments

Comments
 (0)