0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-09-22 10:43:39 -04:00
Commit Graph

767 Commits

Author SHA1 Message Date
H. Peter Anvin
31c4d8bcfd doc: describe caveat with old NASM and new %if directives
Older versions of NASM would not try to match unknown %if directives
with a corresponding %endif, resulting in some very odd consequences
when it comes to trying to handle support for multiple NASM versions.

Document the problem.

Reported-by: E. C. Masloch <pushbx@ulukai.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2025-09-14 04:07:19 -07:00
H. Peter Anvin
1f1f3266d6 preproc: look for what looks to be an unknown conditional
If an unknown preprocessor directive starting with %if or %elif is
encountered, assume it should be treated as a conditional directive
for the purpose of balancing %if...%endif.

This avoids some really ugly problems when dealing with code that is
intended to work across NASM versions that uses %if directives that
don't yet exist.

Reported-by: E. C. Masloch <pushbx@ulukai.org>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-14 03:25:26 -07:00
H. Peter Anvin
7276cfde99 preproc: remove the message-generating functions
The message-generating functions appear to get expanded when they
shouldn't, resulting in errors. Disable them for now and remove them
from the documentation.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-14 02:48:58 -07:00
H. Peter Anvin
84115eeca6 preproc: add %find() and %findi() functions
Add the %find() and %findi() functions to look for a string in a
list. This is useful with picking apart the contents of the
__?DEFAULT?__ macro, for example.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-14 01:24:42 -07:00
H. Peter Anvin
4ccdf7e6fe preproc: add __?DEFAULT?__ macro representing the DEFAULT settings
Create a __?DEFAULT?__ magic macro with the settings of the DEFAULT
directive.

The DEFAULT directive is complex enough that this is best done with a
magic macro.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-14 00:38:50 -07:00
H. Peter Anvin
c719835357 Officially deprecate implicit DEFAULT ABS, add DEFAULT [FS|GS]:[ABS|REL]
Making DEFAULT ABS the default for 64-bit mode was a real
mistake. Issue a warning so we can eventually change it.

Support making FS: and GS: references also be REL by default.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-13 23:15:47 -07:00
H. Peter Anvin
014ca9fdb3 doc: document the %exitmacro directive
The %exitmacro directive was never documented, apparently...

Reported-by: E. C. Masloch <pushbx@ulukai.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2025-09-13 21:47:05 -07:00
H. Peter Anvin
53c2f24c3d doc: 3.0 -> 3.00; tidy up the language for __?NASM_HAS_IFDIRECTIVE?__
Change 3.0 to 3.00 in all version numbers, since NASM has
traditionally expanded all but the major version number to 2 digits.

Make the language related to __?NASM_HAS_IFDIRECTIVE?__ more
consistent.

Reported-by: E. C. Masloch <pushbx@ulukai.org>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-13 21:35:06 -07:00
H. Peter Anvin
746fe8384d doc: even more tidying up of text and index
Purely editorial cleanups.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 23:59:10 -07:00
H. Peter Anvin
90e37ce7f1 doc: more index tweaks and removal of really really old information
Tidy up the index some more, and remove some very, very out of date
information.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 23:36:10 -07:00
H. Peter Anvin
419f369b42 doc: a few more index tweaks
Very minor cleanpus to the index.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 17:53:48 -07:00
H. Peter Anvin
7cc5291ece doc: tweaks to the index
Make the index at least a little bit more legible.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 17:51:38 -07:00
H. Peter Anvin
1d63ae2a3b doc: update the documentation, and auto-generate some indexes
There are currently six variations of each conditionals, and there may
be more in the future (e.g. %while). Stop trying to enumerate them all
everywhere.

Add support for index copying in the document processor.

Have pptok.pl auto-generate index metadata for conditional
preprocessor directives.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 17:12:06 -07:00
H. Peter Anvin
78c98dac0f version: bump version number to 3.0rc0
It seems to make sense to call this upcoming release NASM 3.0.

Suggested by: Yongjie Sheng <sheng.yongjie@intel.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 01:12:27 -07:00
H. Peter Anvin
bb253780ab changes.src: update release log
Add updates to the release documentation.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-04 20:08:15 -07:00
H. Peter Anvin
31a160759d Add %ifdirective preprocessor directive
Along with C and other languages, the current trend is to be able to
probe for features rather than relying on version numbers. This is
motivated in part by the intent of bumping the major version number to
3.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-04 19:41:12 -07:00
H. Peter Anvin
d5bd136ced preproc: add message-generating and %null() functions
Add the %null(), %note(), %warning(), %error(), and %fatal()
functions. They behave like the corresponding directives, then expands
to nothing.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-04 17:10:42 -07:00
H. Peter Anvin
e0d5333a47 doc: add 2.17 release notes and document [dollarhex]
Add the beginnings (at least) of release notes for 2.17, and document
the [dollarhex] directive.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-03 12:31:03 -07:00
H. Peter Anvin
38631c577a doc: there is no %fullpath() function, only %realpath()
Remove a reference to a non-existent %fullpath() function; the
function is called %realpath().

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-03 01:10:29 -07:00
H. Peter Anvin
b3c99f9c19 doc: bump copyright year
It is 2025...

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-03 00:59:04 -07:00
H. Peter Anvin
7e46f6f7ab doc: fix a couple of syntax errors
Fix syntax errors that prevented the documentation from being
buildable.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-03 00:57:43 -07:00
H. Peter Anvin
83534f1f37 Merge remote-tracking branch 'origin/master' into apx.wip
Resolved Conflicts:
	Makefile.in
	Mkfiles/msvc.mak
	Mkfiles/openwcom.mak
	asm/assemble.c
	asm/nasm.c
	asm/parser.c
	doc/Makefile.in
	include/nasm.h
	include/tables.h
	output/legacy.c
	travis/test/br3392531.stderr
	travis/test/br3392716.stderr
	travis/test/org.stderr
	x86/insns.dat

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-08-25 21:09:15 -07:00
H. Peter Anvin
ada267ec8c preproc: let %ifdef test for existence of macro functions
It is good to have a way to test for the existence of macro functions,
and since they are really just a special case of single-line macros,
allow %ifdef to test for them instead of coming up with something
entirely new.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-08-16 19:15:00 -07:00
H. Peter Anvin
0c533873f0 preproc: add %iffile|%isfile() and %realpath()
Add a function to test for the existence of a file, and a function
query the real operating system path, if available.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-08-15 00:32:33 -07:00
H. Peter Anvin
0843052f05 preproc: implement %pathsearch() and %depend() as functions
Implement preprocessor function equivalents of the %pathsearch and
%depend directives.

Simplify the incbin standard macro by using these functions.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-08-14 21:46:55 -07:00
H. Peter Anvin
8ecb5d817a doc: cross-link %if and %is()
Link from %if to %is(), not just the other way.

Clarify that %is() is valid everywhere, not just in an %if expression
(unlike defined() in C.)

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-08-14 19:34:43 -07:00
H. Peter Anvin
23dffbd57a doc: highlight %unimacro a bit more
The %unimacro directive is almost a footnote, but it is really
important to use the correct directive.  Put it on equal footing with
%unmacro.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-08-14 19:28:33 -07:00
H. Peter Anvin
af3cbc7633 doc: tidy up the section about REQUIRED versus EXTERN
It is not great to have the documentation of a behavior change in
EXTERN under REQUIRED.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-08-14 19:16:56 -07:00
H. Peter Anvin
8d62e99e14 Add %note directive to add a note in the list file
This differs from a plain old comment in the following ways:

1. It is optionally macro-expanded;
2. It has a dash prefix;
3. It can be used inside .nolist macros.

Suggested-by: <pushbx@ulukai.org>
Resolves: https://bugzilla.nasm.us/show_bug.cgi?id=3392915
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-09-19 13:21:30 +02:00
H. Peter Anvin
6ad3bab7fe doc: break the documentation into chapters
Make the source code for the documentation a little easier to deal
with by breaking it into individual chapter files. Add support to
rdsrc.pl for auto-generating dependencies.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-08-13 15:55:37 -07:00
H. Peter Anvin
67339f6965 insns: rename addflags.pl to preinsns.pl; use insns.xda for doc
The former addflags.pl now does more general preprocessing, so rename
it from addflags.pl to preinsns.pl.

To generate the instruction list in the documentation, use the
post-preprocessed insns.xda file.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-08-11 21:34:02 -07:00
H. Peter Anvin
a1e3140808 doc: fix the equivalent description for %cond()
%cond(x,y,z) == %sel(1+!(x),y,z), not %sel(2-!(x),y,z).

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-06-01 17:30:27 -07:00
H. Peter Anvin
aa03a95edd doc: improve the build from source documentation
Update and improve the build from source documentation, including add
an auto-generated list of Perl build dependencies.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2024-05-20 10:54:26 -07:00
H. Peter Anvin
2e0212bcd3 doc/rdsrc.pl: add \w{...} to reduce the verbosity of web links
Create a shorthand for a web link where the URL itself is also the text.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2024-05-20 10:31:57 -07:00
Cyrill Gorcunov
0421148e33 doc/nasmdoc.src: fix typo in web link
Reported-by: Danny Cohen <dannycoh@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2024-05-01 21:54:17 +03:00
H. Peter Anvin
68999937f3 doc/nasmdoc.css: @media only print -> @media print
There is no point in using "only" unless there is another
qualifier. The "only" is specifically to prevent older parsers from
unconditionally applying a section with qualifiers.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-25 15:42:25 -07:00
H. Peter Anvin
6165d6c014 Merge remote-tracking branch 'github/nasm-2.16.xx'
Resolved Conflicts:
	doc/changes.src
2024-04-25 15:37:36 -07:00
H. Peter Anvin
68d59933f7 doc/changes.src: begin release notes for 2.16.04.
Better to keep up with it now...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-25 15:36:25 -07:00
H. Peter Anvin
3334c3c2dc Merge remote-tracking branch 'github/nasm-2.16.xx' 2024-04-18 15:32:59 -07:00
H. Peter Anvin
0537b16fdc doc: fix tag label for cl-2.16.03
cl-2.16.03 was incorrectly marked as a dup of cl-2.16.02.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-18 15:30:31 -07:00
H. Peter Anvin
843976d343 Merge remote-tracking branch 'github/nasm-2.16.xx'
Resolved Conflicts:
	autoconf/m4/pa_add_langflags.m4
	autoconf/m4/pa_option_lto.m4
	autogen.sh
	configure.ac
	doc/changes.src
2024-04-18 15:25:48 -07:00
H. Peter Anvin
c4b954931e doc/changes.src: update release notes
Update release notes to match the current status.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-16 16:35:34 -07:00
H. Peter Anvin
a518f3bc72 changes.src: begin release notes for 2.16.03
Probably will have to release a 2.16.03 soon. Start the release notes.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-12 13:24:04 -07:00
H. Peter Anvin
99d3342033 doc: make it clearer than -O0 and -O1 are almost never useful
-Ox is the default, and the preferred mode for almost all users.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-12 11:08:37 -07:00
H. Peter Anvin
6f44296adc doc: get rid of some unnecessarily wordy option descriptions
Some options had unnecessarily wordy titles. Also change Make ->
\c{make}.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-12 11:06:03 -07:00
H. Peter Anvin
1ad669bf06 nasmdoc.css: simplify some media queries
Some media queries were needlessly complicated and misinterpreted by
some browsers.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-04 15:15:05 -07:00
H. Peter Anvin
b11cd3a426 warnings: more improvements to warnings generation
Try to better sort out the necessary dependencies for warning
generation.

Fix regex for cleaning up nasmdoc markup: nasmdoc markup does not
nest, although it may include \} sequences.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-04 14:18:34 -07:00
H. Peter Anvin
33ef63669c doc: improve some formatting, mostly of the warning list
Fix some formatting markups, especially with regards to warnings.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-04 12:58:32 -07:00
H. Peter Anvin
e55c571af4 doc: release notes for 2.16.02
Release notes for 2.16.02 to prepare for imminent release.
2024-04-04 12:56:43 -07:00
H. Peter Anvin
9f83c383e4 preproc, %map(): require second colon, update documentation
Require the second colon before the grouped parameter count; otherwise
the syntax is ambiguous since an expression can start with (.

Update/complete the documentation and the examples.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-16 13:42:16 -07:00