xref: /unit/auto/clang (revision 2079:0dcffa83cac2)
10Sigor@sysoev.ru
20Sigor@sysoev.ru# Copyright (C) Igor Sysoev
30Sigor@sysoev.ru# Copyright (C) NGINX, Inc.
40Sigor@sysoev.ru
50Sigor@sysoev.ru
60Sigor@sysoev.ru# C language features.
70Sigor@sysoev.ru
80Sigor@sysoev.ru
90Sigor@sysoev.runxt_feature="C99 variadic macro"
100Sigor@sysoev.runxt_feature_name=NXT_HAVE_C99_VARIADIC_MACRO
110Sigor@sysoev.runxt_feature_run=yes
12633Svbart@nginx.comnxt_feature_incs=
130Sigor@sysoev.runxt_feature_libs=
140Sigor@sysoev.runxt_feature_test="#include <stdio.h>
150Sigor@sysoev.ru                  #define set(dummy, ...)  sprintf(__VA_ARGS__)
160Sigor@sysoev.ru
170Sigor@sysoev.ru                  int main() {
180Sigor@sysoev.ru                      char  buf[4];
190Sigor@sysoev.ru
200Sigor@sysoev.ru                      buf[0] = '0';
210Sigor@sysoev.ru                      set(0, buf, \"%d\", 1);
220Sigor@sysoev.ru
230Sigor@sysoev.ru                      if (buf[0] == '1')
240Sigor@sysoev.ru                          return 0;
250Sigor@sysoev.ru                      return 1;
260Sigor@sysoev.ru                  }"
270Sigor@sysoev.ru. auto/feature
280Sigor@sysoev.ru
290Sigor@sysoev.ru
300Sigor@sysoev.ruif [ $nxt_found = no ]; then
310Sigor@sysoev.ru
320Sigor@sysoev.ru    nxt_feature="GCC variadic macro"
330Sigor@sysoev.ru    nxt_feature_name=NXT_HAVE_GCC_VARIADIC_MACRO
340Sigor@sysoev.ru    nxt_feature_run=yes
35633Svbart@nginx.com    nxt_feature_incs=
360Sigor@sysoev.ru    nxt_feature_libs=
370Sigor@sysoev.ru    nxt_feature_test="#include <stdio.h>
380Sigor@sysoev.ru                      #define set(dummy, args...)  sprintf(args)
390Sigor@sysoev.ru
400Sigor@sysoev.ru                      int main() {
410Sigor@sysoev.ru                          char  buf[4];
420Sigor@sysoev.ru
430Sigor@sysoev.ru                          buf[0] = '0';
440Sigor@sysoev.ru                          set(0, buf, \"%d\", 1);
450Sigor@sysoev.ru
460Sigor@sysoev.ru                          if (buf[0] == '1')
470Sigor@sysoev.ru                              return 0;
480Sigor@sysoev.ru                          return 1;
490Sigor@sysoev.ru                      }"
500Sigor@sysoev.ru    . auto/feature
510Sigor@sysoev.rufi
520Sigor@sysoev.ru
530Sigor@sysoev.ru
540Sigor@sysoev.runxt_feature="GCC __builtin_expect()"
550Sigor@sysoev.runxt_feature_name=NXT_HAVE_BUILTIN_EXPECT
560Sigor@sysoev.runxt_feature_run=no
570Sigor@sysoev.runxt_feature_incs=
580Sigor@sysoev.runxt_feature_libs=
590Sigor@sysoev.runxt_feature_test="int main(int argc, char *const *argv) {
600Sigor@sysoev.ru                      if ((__typeof__(argc == 0))
610Sigor@sysoev.ru                                   __builtin_expect((argc == 0), 0))
620Sigor@sysoev.ru                          return 0;
630Sigor@sysoev.ru                      return 1;
640Sigor@sysoev.ru                  }"
650Sigor@sysoev.ru. auto/feature
660Sigor@sysoev.ru
670Sigor@sysoev.ru
680Sigor@sysoev.runxt_feature="GCC __builtin_unreachable()"
690Sigor@sysoev.runxt_feature_name=NXT_HAVE_BUILTIN_UNREACHABLE
700Sigor@sysoev.runxt_feature_run=no
710Sigor@sysoev.runxt_feature_incs=
720Sigor@sysoev.runxt_feature_libs=
730Sigor@sysoev.runxt_feature_test="int main() {
740Sigor@sysoev.ru                      __builtin_unreachable();
750Sigor@sysoev.ru                  }"
760Sigor@sysoev.ru. auto/feature
770Sigor@sysoev.ru
780Sigor@sysoev.ru
790Sigor@sysoev.runxt_feature="GCC __builtin_prefetch()"
800Sigor@sysoev.runxt_feature_name=NXT_HAVE_BUILTIN_PREFETCH
810Sigor@sysoev.runxt_feature_run=no
820Sigor@sysoev.runxt_feature_incs=
830Sigor@sysoev.runxt_feature_libs=
840Sigor@sysoev.runxt_feature_test="int main() {
850Sigor@sysoev.ru                      __builtin_prefetch(0);
86633Svbart@nginx.com                      return 0;
870Sigor@sysoev.ru                  }"
880Sigor@sysoev.ru. auto/feature
890Sigor@sysoev.ru
900Sigor@sysoev.ru
9193Smax.romanov@nginx.comnxt_feature="GCC __builtin_clz()"
9293Smax.romanov@nginx.comnxt_feature_name=NXT_HAVE_BUILTIN_CLZ
9393Smax.romanov@nginx.comnxt_feature_run=
9493Smax.romanov@nginx.comnxt_feature_incs=
9593Smax.romanov@nginx.comnxt_feature_libs=
9693Smax.romanov@nginx.comnxt_feature_test="int main() {
9793Smax.romanov@nginx.com                      if (__builtin_clz(1) == 31)
9893Smax.romanov@nginx.com                          return 0;
9993Smax.romanov@nginx.com                      return 1;
10093Smax.romanov@nginx.com                  }"
10193Smax.romanov@nginx.com. auto/feature
10293Smax.romanov@nginx.com
10393Smax.romanov@nginx.com
104701Spluknet@nginx.comnxt_feature="GCC __builtin_popcount()"
105701Spluknet@nginx.comnxt_feature_name=NXT_HAVE_BUILTIN_POPCOUNT
106701Spluknet@nginx.comnxt_feature_run=
107701Spluknet@nginx.comnxt_feature_incs=
108701Spluknet@nginx.comnxt_feature_libs=
109701Spluknet@nginx.comnxt_feature_test="int main() {
110701Spluknet@nginx.com                      if (__builtin_popcount(5) == 2)
111701Spluknet@nginx.com                          return 0;
112701Spluknet@nginx.com                      return 1;
113701Spluknet@nginx.com                  }"
114701Spluknet@nginx.com. auto/feature
115701Spluknet@nginx.com
116701Spluknet@nginx.com
1170Sigor@sysoev.runxt_feature="GCC __attribute__ visibility"
1180Sigor@sysoev.runxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_VISIBILITY
1190Sigor@sysoev.runxt_feature_run=
120633Svbart@nginx.comnxt_feature_incs=
1210Sigor@sysoev.runxt_feature_libs=
1220Sigor@sysoev.runxt_feature_test="int n __attribute__ ((visibility(\"default\")));
1230Sigor@sysoev.ru
1240Sigor@sysoev.ru                  int main() {
1250Sigor@sysoev.ru                      return 1;
1260Sigor@sysoev.ru                  }"
1270Sigor@sysoev.ru. auto/feature
1280Sigor@sysoev.ru
1290Sigor@sysoev.ru
1300Sigor@sysoev.runxt_feature="GCC __attribute__ aligned"
1310Sigor@sysoev.runxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_ALIGNED
1320Sigor@sysoev.runxt_feature_run=
133633Svbart@nginx.comnxt_feature_incs=
1340Sigor@sysoev.runxt_feature_libs=
1350Sigor@sysoev.runxt_feature_test="int n __attribute__ ((aligned(64)));
1360Sigor@sysoev.ru
1370Sigor@sysoev.ru                  int main() {
1380Sigor@sysoev.ru                      return 1;
1390Sigor@sysoev.ru                  }"
1400Sigor@sysoev.ru. auto/feature
1410Sigor@sysoev.ru
1420Sigor@sysoev.ru
1430Sigor@sysoev.runxt_feature="GCC __attribute__ malloc"
1440Sigor@sysoev.runxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_MALLOC
1450Sigor@sysoev.runxt_feature_run=
146633Svbart@nginx.comnxt_feature_incs=
1470Sigor@sysoev.runxt_feature_libs=
1480Sigor@sysoev.runxt_feature_test="#include <stdlib.h>
1490Sigor@sysoev.ru
1500Sigor@sysoev.ru                  void *f(void) __attribute__ ((__malloc__));
1510Sigor@sysoev.ru
1520Sigor@sysoev.ru                  void *f(void) {
1530Sigor@sysoev.ru                      return malloc(1);
1540Sigor@sysoev.ru                  }
1550Sigor@sysoev.ru
1560Sigor@sysoev.ru                  int main() {
1570Sigor@sysoev.ru                      if (f() != NULL) {
1580Sigor@sysoev.ru                          return 1;
1590Sigor@sysoev.ru                      }
1600Sigor@sysoev.ru                      return 0;
1610Sigor@sysoev.ru                  }"
1620Sigor@sysoev.ru. auto/feature
163169Svbart@nginx.com
164169Svbart@nginx.com
165169Svbart@nginx.comnxt_feature="GCC __attribute__ packed"
166169Svbart@nginx.comnxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_PACKED
167169Svbart@nginx.comnxt_feature_run=
168633Svbart@nginx.comnxt_feature_incs=
169169Svbart@nginx.comnxt_feature_libs=
170187Smax.romanov@nginx.comnxt_feature_test="struct s {
171169Svbart@nginx.com                      char c;
172187Smax.romanov@nginx.com                      int i;
173187Smax.romanov@nginx.com                  } __attribute__ ((__packed__));
174169Svbart@nginx.com
175169Svbart@nginx.com                  int main() {
176169Svbart@nginx.com                      return 1;
177169Svbart@nginx.com                  }"
178169Svbart@nginx.com. auto/feature
179*2079Salx.manpages@gmail.com
180*2079Salx.manpages@gmail.com
181*2079Salx.manpages@gmail.comnxt_feature="GCC __attribute__ unused"
182*2079Salx.manpages@gmail.comnxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_UNUSED
183*2079Salx.manpages@gmail.comnxt_feature_run=
184*2079Salx.manpages@gmail.comnxt_feature_incs=
185*2079Salx.manpages@gmail.comnxt_feature_libs=
186*2079Salx.manpages@gmail.comnxt_feature_test="static void f(void) __attribute__ ((__unused__));
187*2079Salx.manpages@gmail.com
188*2079Salx.manpages@gmail.com                  static void f(void)
189*2079Salx.manpages@gmail.com                  {
190*2079Salx.manpages@gmail.com                      return;
191*2079Salx.manpages@gmail.com                  }
192*2079Salx.manpages@gmail.com
193*2079Salx.manpages@gmail.com                  int main(void) {
194*2079Salx.manpages@gmail.com                      return 0;
195*2079Salx.manpages@gmail.com                  }"
196*2079Salx.manpages@gmail.com. auto/feature
197