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>
Apparently, at least on some OS/2 compilers, <sys/types.h> needs to be
included for off_t to be defined. This seems like a generically good
idea to include this header whenever it is available.
Remove reference to <types.h>. This was supposedly for MSVC, but
there is no actual evidence that it is useful beyond <sys/types.h>.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Instead of trying to do hacks in the Makefiles, define header files
for specific compilers if they can't use autoconf. Currently defined
for Microsoft Visual Studio, based on MSDN documentation. It is
currently untested.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
A number of fairly common operations are invoked way too many times,
especially when using incbin. Drastically reduce the number of system
calls that need to be executed, and use memory mapping to reduce
unnecessary double buffering.
We could improve this further by leaving files open once used;
however, that might run into file count problems on some systems.
Still unclear is why we seem to invoke nasm_file_size() twice per pass
for incbin.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Disable common data to:
a) discover problems with common data as quickly as possible (we
should not use common data as some compilers may not handle it);
b) work around a problem with the OSX linker causing it to not find
zero_buffer even though it is defined in nasmlib/zerobuf.c.
Reported-by: anonymous coward <nasm64developer@users.sf.net>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Make the source code easier to understand and keep track of by
organizing it into subdirectories depending on the function.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
nasmlib.c had basically turned into a garbage bin of various functions
with very little in common. Break it up into logical components for
isolation and manageability.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>