Giving a correct printf format specifier supresses the warning message.
And a local pointer variable is initialized with NULL.
Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Multi-line macro uses curly braces for enclosing a parameter
containing comma(s). Passing curly braces as a part of a parameter
which is already enclosed with braces confuses the macro expander.
Escape character '\' is prefixed in this case.
e.g.) mmacro {1,2,3}, {4,\{5,6\}}
mmacro gets 2 parameters of '1,2,3' and '4,{5,6}'
Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
In commit f1fe4fdeab I occasionally
made a \Space after \BackSlash being a sign of line continuation.
Fix it.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This should make it easier to read and moreover
now we're able to preprocess pasting as
%define N 1e%++%+ 5
dd N, 1e+5
Note that N should be expanded as series of pasting
to 1e+5 term, but before this patch we were ending
up in 1e+%+ 5 which is wrong.
In other words the fixed version output is
dd 1e+5, 1e+5
while broken one was
dd 1e+%+ 5, 1e+5
This patch also fixes nil dereferences in case if
there is no left or right token around pasting term.
http://bugzilla.nasm.us/show_bug.cgi?id=3392207
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
[backport 290eac7569]
2.09 series was the last one we support context-thru search
(and we were issuing a warning about that) so drop all-context
from get_ctx() routine.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
The NASM 2.09 preprocessor allows some illogical constructs, but which
unfortunately has been found in real code in the field. We need
a compatibility solution or a pragma before we can avoid that.
However, we need the other features in NASM 2.10 to come out, so
revert the preprocessor changes for now.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
In case if there a production
{tok},{%+},{whitespace}*
the preprocessor does not delete
ending paste+spaces tokens. Fix it.
http://bugzilla.nasm.us/show_bug.cgi?id=3392200
Reported-by: KO Myung-Hun <komh@chollian.net>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
It is a potential place for a bug if list_for_each
helper is used with multiple lines of code without
a proper bracing.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
In case if there a trailing spaces after expansion
%if[n]def might produce a false alarms on macro id
being expected.
Note it also makes the constructions like bare
%ifdef
%endif
invalid, while before they were passed well without
a notice.
Reported-by: KO Myung-Hun
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
new_ExpDef does zalloc'ate memory so no need
to assign zeros again.
Same time it should fix MSC complains on NULL assignment
on boolean variable.
Reported-by: Jasper Neuman <jasper.neumann@web.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
There is no need to hide this structure into a type.
The former preproc_ops is a way more descriptive.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2.09 series was the last one we support context-thru search
(and we were issuing a warning about that) so drop all-context
from get_ctx() routine.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This reverts commit cb00cd1ba7.
As Victor pointed out some tests do not pass with this commit
so revert it until things get fixed.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
It's a bit more than that, also TRACE=1 make
flag added to run this facility on and off
at compiling time.
Debug feature only, doesn't affect regular users.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
We simply allow the following terminals to be concat'ed
if they are written without space or any other separator
inbetween.
a := id | preproc-id | number | float | other
b := id | preproc-id | number | float | other
if match(a,b):
s := concat(a,b)
re-tokenize(s)
Basically it means it's up to code author to write
preproc code a way the sane production appears.
Some notes.
1) We don't concat strings.
2) The 'weirdpaste' test fails now because with relaxed
rules it works as needed and was borken before.
The lacmus snippet is
%define N 1e%++%+ 5
dd N, 1e+5
Previously the output was
dd 1e+%+ 5, 1e+5
which is wrong since we have explicit concat here
with %+ operator. The new code production is correct
and looks like
dd 1e+5, 1e+5
as expected.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
src_set_fname simply gets copy of pointer (ideally
we need refcounting here) so don't pass the name
which will be freed soon but rather pass a copy.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>