clang, unlike gcc, will warn on inline functions which are
unused. This can happen if a function is either intended to be used in
the future, or it is only used under certain config options. Mark
those functions with the "unused" attribute; not only does it quiet
the warning, but it also documents it for the user.
Shuffle around the warning options in configure and add a few more
that are specific to clang.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Set an expression descent limit to 8192, which is more reasonable to
expect to work on most platforms. Furthermore, if getrlimit() exists,
then try to use it to see if we need to further limit the size.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Significantly improve the portability/reliability of a general
make command. Build a .pdf.xz version of the documentation,
using an uncompressed pdf as basis.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
config/config.h as generated by autoconf has #undef directives
commented out, but the autoheader-generated template contains them,
and config/unconfig.h should not contain them. Re-introduce
config/config.h.in, and postprocess it to generate config/unconfig.h
by commenting out all the #undef directives, just as configure does.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
--disable-pedantic passed to configure will now disable
-W, -Wc90-c99-compat, and -pedantic.
Requested-by: Orzkan Sezer <sezeroz@gmail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Separate out function and function pointer attributes, as not all
versions of all compilers support both.
Have macros related to function attributes auto-generated by
autoheader. As a result, rename config.h.in to unconfig.h, to make it
more obvious that it is really intended to be included from some C
programs.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Windows supports pathnames up to 32767 UTF-16 characters, but using
the standard interfaces only up to 260 characters. Wrap the functions
that take filenames on Windows.
Clean up the compatiblity layers some more for reduced #ifdefs.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
The name "aux" is reserved on Windows platforms, a legacy from CP/M
via MS-DOS. Rename it to "helpers".
Turns out that that directory wasn't actually used properly, because
AC_CONFIG_AUX_DIR was never defined, and there was a redundant copy of
install-sh checked into the base of the source tree.
Reported-by: Ehsan Alem Mohammad Ghasemlou <e.ghasemloo@gmail.com>
NASM-Bugzilla: https://bugzilla.nasm.us/show_bug.cgi?id=3392560
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Try to make nasm_assert() do a static assert if the argument can be
evaluated at compile time by any particular compiler. We also provide
nasm_try_static_assert() which will assert a compile-time expression
if and only if we can determine we have a constant at compile time
*and* we know that the compiler has a way to handle it.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Section garbage collect really is quite useful, and it makes managing
library source code management a little bit less stressful. It has
been used by the official builds for a while now, turn it on by
default.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Make it a selectable option at allocation time if a strlist should
contain only unique strings or not. If not, we omit the hash table and
strlist_find() will not do anything.
Add printf()-style functions to a strlist.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Shifting negative values is undefined in standard C, but we have tons
of dependencies that signed arithmetic is 2's-complement in the code
anyway, and on gcc-like compilers we pass the -fwrapv option to
indicate exactly that. Therefore, this is not a valid warning in our
case and should be suppressed.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Add a version of (v)asprintf(), which allocates a string on the
heap. Unlike the standard version of (v)asprintf(), we return the
pointer; if one wants the length of the string then one can simply use
the %n pattern.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Create our own ctype table where we can do the tests we want to do
cheaply, instead of calling ctype functions and then adding additional
tests all over the code.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
There is no reason to use -O3; it causes code to be insanely
duplicated. Simplify the configure.ac file too.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
strncpy() is correctly used to fill in a zero-*padded* (not
zero-terminated) field in several places. Make gcc not complain about
those uses.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
None of our symbols are available for a dynamic library, and if they
were, there would be no point in allowing them to be overridden. This
optimizes code generation for global symbols.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
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>
Get rid of remaining dependencies on FILENAME_MAX, which ought to have
been removed a long time ago.
Remove ofmt->filename(); all implementations pretty much do the same
thing and there is absolutely no reason to duplicate that
functionality all over the place.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Make further autoconf rule improvements and update the required
version of autoconf to 2.69. That version is now 5+ years old and
although there might be older versions which have the prerequisite
macros they are known to have lots of bugs, and we can't really test
them.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Make -O0 imply -fno-omit-frame-pointer
Add options to compile/link with AddressSanitizer and
UndefinedSanitizer.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Move byte order handling functions to their own header file, and try
to be more specific about how exactly to handle things.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
The --enable-sections option isn't too useful without
-Wl,--gc-sections. It's unclear if gcc will provide that option by
default.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
An uncompressed PDF is about twice as big, but if one is using an
external compression program (e.g. .pdf.xz) it compresses far better.
Use it for the RPM specfile.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
We have separate invocations for the various PDF tools anyway. It
generates a slightly annoying error message, but makes some other
things a little easier.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>