patch 8.0.1730: no configure check for the used C99 features

Problem:    No configure check for the used C99 features.
Solution:   Add a compilation check.  Tentatively document C99 features.
This commit is contained in:
Bram Moolenaar
2018-04-17 22:02:45 +02:00
parent ea3ece405a
commit 561f8a5a46
4 changed files with 102 additions and 3 deletions
+34
View File
@@ -4179,6 +4179,40 @@ $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler can handle Vim code" >&5
$as_echo_n "checking if the compiler can handle Vim code... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdio.h>
int
main ()
{
struct with_flexible_member {
int count; // comment
char text[]; // another comment
};
enum {
one,
two,
three,
};
long long int a = 1;
long long unsigned b = 2;
printf("a %lld and a %llu", a, b);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
as_fn_error $? "compiler does not work properly - see auto/config.log" "$LINENO" 5
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-fail-if-missing argument" >&5
$as_echo_n "checking --enable-fail-if-missing argument... " >&6; }
+23
View File
@@ -29,6 +29,29 @@ dnl in autoconf needs it, where it uses STDC_HEADERS.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
dnl Check that the C99 features that Vim uses are supported:
dnl - // commands
dnl - comma after last enum item
dnl - "long long int" and "long long unsigned"
dnl - flexible array member
AC_MSG_CHECKING(if the compiler can handle Vim code)
AC_TRY_COMPILE([#include <stdio.h>], [
struct with_flexible_member {
int count; // comment
char text[]; // another comment
};
enum {
one,
two,
three,
};
long long int a = 1;
long long unsigned b = 2;
printf("a %lld and a %llu", a, b);
],
AC_MSG_RESULT(yes),
AC_MSG_ERROR([compiler does not work properly - see auto/config.log]))
dnl Check for the flag that fails if stuff are missing.
AC_MSG_CHECKING(--enable-fail-if-missing argument)
+2
View File
@@ -762,6 +762,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1730,
/**/
1729,
/**/