Commit graph

11 commits

Author SHA1 Message Date
H. Peter Anvin (Intel)
c9467688b4 Add [v]printf_func() attributes where appropriate
Add a new macro vprintf_func() for vprintf-style functions, and add
printf_func() and vprintf_func() attribute arguments whereever
meaningful.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-07-30 17:30:20 -07:00
H. Peter Anvin (Intel)
c665ba1fd8 strlist.h: move safe_alloc declaration
Move the safe_alloc declaration after the * symbol to be consistent
with all other functions with this attribute. Just in case it matters
somewhere...

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-07-01 20:54:58 -07:00
H. Peter Anvin (Intel)
65ab3ab197 clang: mark inline functions unused and add warning options
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>
2020-06-30 10:14:21 -07:00
H. Peter Anvin (Intel)
d6e817751e listing: add -L option for additional listing info
Add an -L option for additional listing information. Currently
supported is -Le, which emits each line after processing through the
preprocessor, and -Lm, which displays each single-line macro defined
or undefined.

NASM doesn't preserve the names of unused arguments, nor does it have
any technical reason to do so. Instead of adding complexity to save
them, make unnamed parameters official by specifying an empty string
in the argument list.

This has the additional advantage that () is now simply considered a
single empty argument, which means that NASM should now properly
handle things like:

%define myreg() eax
	mov edx,myreg()

... similar to how the C preprocessor allows an empty macro argument
list which is distinct from a macro with no arguments whatsoever.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-09 08:39:02 -07:00
H. Peter Anvin (Intel)
374312cde4 strlist, warnings: improve strlist, buffer warnings until error
Make strlist_free() take a pointer to a pointer, so we can set it to
NULL.

Buffer warnings on a strlist until we either get an error or we are in
pass 2. Hopefully this should let us get rid of a lot of the ERR_PASS*
bullshit, which far too often causes messages to get lost.

asm/labels.c contains one example of a warning that cannot be made
correct with a specific pass number.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-14 00:17:13 -08:00
H. Peter Anvin (Intel)
7bb13eac11 strlist: can be unique or not, add printf functions
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>
2018-12-13 22:48:14 -08:00
H. Peter Anvin (Intel)
64471097ca strlist: merge the strtbl and strlist interfaces
The currently-unused strtbl was basically a slightly different version
of strlist, with the find and linearize capabilities. Merge these two
together by augmenting strlist to have the same capabilities.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-11 13:37:32 -08:00
H. Peter Anvin (Intel)
ebb05a0e5f hashtbl: revamp the hash table interface, support binary keys
Add binary key support to the hash table interface. Clean up the
interface to contain less extraneous crud.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-11 13:18:49 -08:00
Cyrill Gorcunov
b7bb5acdaf strlist: Rework to drop type
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-24 13:24:09 +03:00
H. Peter Anvin (Intel)
f7106d06e4 strlist: use a hash table
Use a hash table to enforce uniqueness in a string list. It is still
an ordered list, however, and can be walked in insertion order.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-10-25 12:33:58 -07:00
H. Peter Anvin
436e367874 Factor out common string list handling code
Simplify the preprocessor code by factoring out the common string list
handling code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-10-04 01:12:28 -07:00