From: Igor Sysoev Date: Tue, 30 Aug 2016 09:11:24 +0000 (+0300) Subject: C language features have been enabled. X-Git-Tag: 0.1.2~9 X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/static/gitweb.js?a=commitdiff_plain;h=27ec588f05d6a83d5ad6e7574a53bfd4e9058efd;p=njs.git C language features have been enabled. --- diff --git a/nxt/auto/clang b/nxt/auto/clang index 6ca47c1c..19df1232 100644 --- a/nxt/auto/clang +++ b/nxt/auto/clang @@ -162,3 +162,89 @@ cat << END >> $NXT_MAKEFILE_CONF NXT_CC = ${CC} NXT_CFLAGS = ${CFLAGS} ${NXT_CFLAGS} END + + +# C language features. + +nxt_feature="GCC __builtin_expect()" +nxt_feature_name=NXT_HAVE_BUILTIN_EXPECT +nxt_feature_run=no +nxt_feature_incs= +nxt_feature_libs= +nxt_feature_test="int main(int argc, char *const *argv) { + if ((__typeof__(argc == 0)) + __builtin_expect((argc == 0), 0)) + return 0; + return 1; + }" +. ${NXT_AUTO}feature + + +nxt_feature="GCC __builtin_unreachable()" +nxt_feature_name=NXT_HAVE_BUILTIN_UNREACHABLE +nxt_feature_run=no +nxt_feature_incs= +nxt_feature_libs= +nxt_feature_test="int main() { + __builtin_unreachable(); + }" +. ${NXT_AUTO}feature + + +nxt_feature="GCC __builtin_prefetch()" +nxt_feature_name=NXT_HAVE_BUILTIN_PREFETCH +nxt_feature_run=no +nxt_feature_incs= +nxt_feature_libs= +nxt_feature_test="int main() { + __builtin_prefetch(0); + }" +. ${NXT_AUTO}feature + + +nxt_feature="GCC __attribute__ visibility" +nxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_VISIBILITY +nxt_feature_run= +nxt_feature_path= +nxt_feature_libs= +nxt_feature_test="int n __attribute__ ((visibility(\"default\"))); + + int main() { + return 1; + }" +. ${NXT_AUTO}feature + + +nxt_feature="GCC __attribute__ aligned" +nxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_ALIGNED +nxt_feature_run= +nxt_feature_path= +nxt_feature_libs= +nxt_feature_test="int n __attribute__ ((aligned(64))); + + int main() { + return 1; + }" +. ${NXT_AUTO}feature + + +nxt_feature="GCC __attribute__ malloc" +nxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_MALLOC +nxt_feature_run= +nxt_feature_path= +nxt_feature_libs= +nxt_feature_test="#include + + void *f(void) __attribute__ ((__malloc__)); + + void *f(void) { + return malloc(1); + } + + int main() { + if (f() != NULL) { + return 1; + } + return 0; + }" +. ${NXT_AUTO}feature