summaryrefslogtreecommitdiff
path: root/compiler.h
AgeCommit message (Collapse)AuthorFilesLines
2009-08-10Add strlcpy() functionH. Peter Anvin1-0/+4
Add strlcpy() function and implementation, and use configure to detect if strlcpy() is natively available on the system. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-05Change noreturn macro to no_return to avoid header file problemsH. Peter Anvin1-2/+2
Change the "noreturn" macro to "no_return", to avoid problems with system header files which use __attribute__((noreturn)) rather than __attribute__((__noreturn__)) as is appropriate for system headers. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-01compiler.h: new macro for a non-returning functionH. Peter Anvin1-0/+9
Add a new macro for a non-returning function. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-06-28Add copyright headers to the *.c/*.h files in the main directoryH. Peter Anvin1-4/+27
Add copyright headers to the *.c/*.h files in the main directory. For files where I'm sure enough that we have all the approvals, I have given them the 2-BSD license, the others have been given the "LGPL for now" license header. Most of them can probably be changed after auditing. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-03-01autoconf: detect the broken bool in OpenWatcom 1.8H. Peter Anvin1-1/+1
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.
2008-10-30compiler.h: add offsetof() and container_of()H. Peter Anvin1-1/+14
offsetof() is a C99 construct; provided here as an ersatz for older systems. container_of() is a nonstandard but highly useful construct, which allows data structure control items like tree structures to be embedded in larger data structures without the penalty of extra pointers and allocations. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-06-10Make it possible to use "inline" and "restrict"H. Peter Anvin1-2/+14
Put the appropriate machinery in place to be able to use the "inline" and "restrict" keywords with appropriate semantics.
2008-06-10Introduce likely/unlikely macros, use them in saa.cH. Peter Anvin1-0/+12
Introduce the likely() and unlikely() macros, as used in Linux. They are compiler-dependent hints that a particular boolean expression is likely to be true or false, respectively. Currently only implemented for gcc.
2008-06-08Use autoconf to detect WORDS_LITTLEENDIANH. Peter Anvin1-0/+3
Use autoconf to detect littleendian word order, and use WORDS_LITTLEENDIAN instead of X86_MEMORY when we don't require unaligned memory accesses to be permitted.
2008-02-16Some compilers define __386__ instead of __i386__H. Peter Anvin1-1/+1
OpenWatcom, and possibly other compilers from the DOS universe, defines __386__ rather than __i386__.
2007-12-29regularized spelling of license to match name of LICENSE fileBeroset1-1/+1
2007-11-13Address data is int64_t; simplify writing an address objectH. Peter Anvin1-0/+11
Address data is always int64_t even if the size itself is smaller; this was broken on bigendian hosts (still need testing!) Create simple "write sized object" macros.
2007-10-26Better handling of platforms which hide "extended" functionalityH. Peter Anvin1-5/+21
Some platforms apparently feel -std=c99, which defines __STRICT_ANSI__, should also hide a bunch of function prototypes. This rather sucks. At least try to deal with it. MinGW and DJGPP both have this problem, in particular.
2007-10-18Cleaner solution for MinGW handling of __STRICT_ANSI__H. Peter Anvin1-0/+5
If MinGW is detected, undefine __STRICT_ANSI__ in compiler.h instead.
2007-10-11Define macros necessary for <inttypes.h> on C++H. Peter Anvin1-0/+7
NASM currently doesn't compile with a C++ compiler, but the error messages are sometimes useful. Define macros necessary for <inttypes.h> to work with a C++ compiler.
2007-10-10Use the compiler-provided booleans if available, otherwise emulateH. Peter Anvin1-0/+8
Both C and C++ have "bool", "true" and "false" in lower case; C requires <stdbool.h> for this, in C++ it is an inherent type built into the compiler. Use those instead of the old macros; emulate with a simple typedef enum if unavailable.
2007-10-03Use autoconf to request feature macrosH. Peter Anvin1-8/+0
2007-10-02Portability fixesH. Peter Anvin1-4/+14
Concentrate compiler dependencies to compiler.h; make sure compiler.h is included first in every .c file (since some prototypes may depend on the presence of feature request macros.) Actually use the conditional inclusion of various functions (totally broken in previous releases.)
2007-09-28Add substitutes for snprintf() and vsnprintf()H. Peter Anvin1-5/+16
To deal with fools^Wpeople trying to keep really old systems alive, create a proper framework for substitution functions, and make it possible to deal with the lack of snprintf/vsnprintf in particular.
2007-09-17Cleaner way to handle MSVC's _snprintf() underscore damageH. Peter Anvin1-0/+10
Some versions of MSVC have snprintf() and vsnprintf() only with a leading underscore. Handle that a bit more cleanly.
2007-04-13AIf we have config.h, we should actually include it!!H. Peter Anvin1-2/+6
Apparently configure was generating config.h, and nothing ever actually included it. Include it in nasm.h as well as compiler.h, and in rdoff/rdlar.h which uses these macros. There appears to be no use of HAVE_* macros in any file that doesn't have nasm.h included; in fact, so far the only use has been in rdoff/rdlar.h.
2007-04-13Macroize any compiler-specific code; macros defined in "compiler.h"H. Peter Anvin1-0/+36
Move anything compiler-specific to "compiler.h". There was an unguarded use of __attribute__(()) in outmacho.c; also require gcc 4+ for __builtin_ctlz(). Speed up the open-coded version, too.