Simplify the nasm_malloc() code by moving the pointer check into a
common subroutine.
We can now issue a filename error even for failures like malloc().
Add support for the gcc sentinel attribute (verify that a list ends
with NULL).
Add a handful of safe_alloc attributes.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Some older versions of gcc (gcc 4.2.1 at least) produce a warning,
promoted to error, on C99 inlines. Do some work to figure out if we
need to fall back to GNU inline syntax.
Fix some issues with GNU inline syntax.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
PA_HAVE_FUNC() would fail on some systems for inline functions or
macros due to missing #includes. Also modernize to current autoconf
style.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
autoconf complained about this dnl, and it's not necessary anyway (and
perhaps even potentially harmful?
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Add defines for added CFLAGS. This can be useful, for example, for
LTO or sanitizers being enabled.
Various cleanups for readability and documentation; use macros
available in current autoconf.
Add new utility function PA_SYM(), similar to AS_TR_CPP() except
collapses sequential underscores.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Make it possible to request testing for a header file, which if found,
will be always included for futher tests.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
AC_ARG_ENABLE() doesn't really work the way you expect: one argument
is called on *any* invocation. Create simple helper wrappers to get
the effect we really want for boolean options.
Define WINELOADER=/dev/null to prevent autoconf from inadvertently
running Wine and think we are not cross-compiling even if we are. It
is at the very best slow and buys us absolutely nothing.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Put in the necessary machinery to compile with gcc link-time
optimization. This means compiling and linking with -flto, as well as
using gcc-ar and gcc-ranlib instead of the normal tools.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Instead of using hacks or compiler-specific features, if we have
standard features as defined in ISO C11, use them.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Use autoconf to detect function attributes; some compilers like Sun CC
do support some gcc-style attributes, but don't define __GNUC__. Also
-U__STRICT_ANSI__ already in configure.ac so our tests match what we
might eventually encounter.
Add const_func and pure_func attributes.
Decorate functions in nasmlib.h with const_func and pure_func.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
There is no reason to not use an archive manager to build our
executables. If there really are systems which don't have any kind of
archive manager, we can simply link all the objects.
This also drops any use of configure to detect library objects.
Instead just use HAVE_* and let the archive manager delete them.
A lot of additional functions could be declared library functions and
reorganized.
***FIX*** Mkfiles/*.mak have not yet been updated.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
We are supposed to handle compiling on a "C90 plus long long"
compiler, so make gcc (our most common development platform compiler)
complain when we don't.
However, suppress the complaints about the Microsoft definitions of
the <inttypes.h> strings.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
OpenWatcom 1.8 has a C99 mode, which implements _Bool and
<stdbool.h>. Unfortunately the implementation is broken, and doesn't
let _Bool be implicitly converted to integer (as required by the C99
spec). Detect this case in autoconf.
We can actually test for the options being accepted, rather than try
to test for gcc; this handles differences between gcc versions as well
as compilers with a similar command line set.