Skip to content

Commit

Permalink
enable ax_restrict
Browse files Browse the repository at this point in the history
re-format docs: autoconf-archive is pretty strict
gcc-9.2 on fedora has it fixed.

enable it.  we do have several small inlined functions with loops on arrays,
so it might affects us. See GH #141
  • Loading branch information
rurban committed Dec 25, 2019
1 parent de8467a commit 5c4464e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
30 changes: 15 additions & 15 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ ac_cv_func_realloc_0_nonnull=yes
AC_CHECK_HEADERS([stdlib.h string.h stddef.h unistd.h malloc.h wchar.h ctype.h \
libgen.h getopt.h alloca.h valgrind/valgrind.h])
AX_INCLUDE_STRCASECMP
# AX_RESTRICT

# Don't bother testing for libps headers if libps is not available.
if test yes = "$libredwg_have_libps" ; then
Expand Down Expand Up @@ -223,6 +222,21 @@ case $host in
esac
dnl x86_64-mingw-w64-gcc-9.2 is seriously broken, and not just mingw-w64

dnl --enable-debug sets DEBUG_CLASSES, will crash acad import
AC_MSG_CHECKING([--enable-debug])
AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[
Enable unstable DEBUG_CLASSES (default: no).]),
[if test x$ac_compiler_gnu = xyes; then
CFLAGS="`echo $CFLAGS|sed 's,-O2,,'` -fno-omit-frame-pointer"
fi
CFLAGS="$CFLAGS -DDEBUG_CLASSES"]
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no (default)]))
AM_CONDITIONAL([ENABLE_DEBUG], [test x$enable_debug = xyes])

AX_ADD_FORTIFY_SOURCE
AX_RESTRICT

dnl Feature: --disable-write
AC_MSG_CHECKING([--disable-write])
AC_ARG_ENABLE([write],AS_HELP_STRING([--disable-write],[
Expand Down Expand Up @@ -250,20 +264,6 @@ AC_CHECK_FUNCS([setenv],[],
[AC_MSG_RESULT([setenv not needed. no --enable-trace.])]
))

dnl --enable-debug sets DEBUG_CLASSES, will crash acad import
AC_MSG_CHECKING([--enable-debug])
AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[
Enable unstable DEBUG_CLASSES (default: no).]),
[if test x$ac_compiler_gnu = xyes; then
CFLAGS="`echo $CFLAGS|sed 's,-O2,,'` -fno-omit-frame-pointer"
fi
CFLAGS="$CFLAGS -DDEBUG_CLASSES"]
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no (default)]))
AM_CONDITIONAL([ENABLE_DEBUG], [test x$enable_debug = xyes])

AX_ADD_FORTIFY_SOURCE

dnl --disable-dxf only useful for faster debug/test cycles
AC_MSG_CHECKING([--disable-dxf])
AC_ARG_ENABLE([dxf],AS_HELP_STRING([--disable-dxf],[
Expand Down
11 changes: 6 additions & 5 deletions m4/ax_restrict.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_restrict.html
# https://www.gnu.org/software/autoconf-archive/ax_restrict.html
# ===========================================================================
#
# SYNOPSIS
Expand All @@ -9,10 +9,11 @@
# DESCRIPTION
#
# This macro checks if the C99 restrict keyword is broken with the current
# compiler and optimizations settings. If broken, it undefines restrict to do
# no harm. As of 2019 gcc since 5.0 and clang since 6.0 (June 2017) are known to be
# broken and not yet fixed. See https://github.com/rust-lang/rust/issues/54878
# with the links to the gcc and clang tickets.
# compiler and optimizations settings. If broken, it undefines restrict to
# do no harm. As of 2019 gcc since 5.0 and clang since 6.0 (June 2017) are
# known to be broken and not yet fixed. See
# https://github.com/rust-lang/rust/issues/54878 with the links to the gcc
# and clang tickets.
#
# LICENSE
#
Expand Down
3 changes: 3 additions & 0 deletions src/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@
/* Define to rpl_realloc if the replacement function should be used. */
#undef realloc

/* If restrict is broken with this compiler */
#undef restrict

/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t

Expand Down

0 comments on commit 5c4464e

Please sign in to comment.