You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(208) |
Jun
(43) |
Jul
|
Aug
(2) |
Sep
(17) |
Oct
|
Nov
(4) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
(11) |
Mar
(3) |
Apr
(2) |
May
|
Jun
(3) |
Jul
(29) |
Aug
(29) |
Sep
(48) |
Oct
|
Nov
|
Dec
(5) |
2004 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2005 |
Jan
(12) |
Feb
(1) |
Mar
(1) |
Apr
|
May
(1) |
Jun
(2) |
Jul
|
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(1) |
Dec
(2) |
2006 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(21) |
Nov
(25) |
Dec
(16) |
2007 |
Jan
(26) |
Feb
(26) |
Mar
(18) |
Apr
(51) |
May
(45) |
Jun
(26) |
Jul
(6) |
Aug
(85) |
Sep
(161) |
Oct
(111) |
Nov
(83) |
Dec
(18) |
2008 |
Jan
(31) |
Feb
(27) |
Mar
|
Apr
(16) |
May
(142) |
Jun
(136) |
Jul
(51) |
Aug
(21) |
Sep
(47) |
Oct
(428) |
Nov
(19) |
Dec
(6) |
2009 |
Jan
(11) |
Feb
(37) |
Mar
(17) |
Apr
(15) |
May
(13) |
Jun
(61) |
Jul
(127) |
Aug
(15) |
Sep
(22) |
Oct
(28) |
Nov
(37) |
Dec
(10) |
2010 |
Jan
(18) |
Feb
(22) |
Mar
(10) |
Apr
(41) |
May
|
Jun
(48) |
Jul
(61) |
Aug
(54) |
Sep
(34) |
Oct
(15) |
Nov
(49) |
Dec
(11) |
2011 |
Jan
|
Feb
(24) |
Mar
(10) |
Apr
(9) |
May
|
Jun
(33) |
Jul
(41) |
Aug
(20) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
(86) |
Mar
(12) |
Apr
|
May
(10) |
Jun
|
Jul
(9) |
Aug
(4) |
Sep
(11) |
Oct
(3) |
Nov
(3) |
Dec
(10) |
2013 |
Jan
(1) |
Feb
(23) |
Mar
(15) |
Apr
(7) |
May
(20) |
Jun
(3) |
Jul
(15) |
Aug
|
Sep
(29) |
Oct
(16) |
Nov
(69) |
Dec
(18) |
2014 |
Jan
|
Feb
(8) |
Mar
|
Apr
|
May
(16) |
Jun
(7) |
Jul
|
Aug
(5) |
Sep
(2) |
Oct
(4) |
Nov
(25) |
Dec
(8) |
2015 |
Jan
(6) |
Feb
(6) |
Mar
|
Apr
(1) |
May
(2) |
Jun
(1) |
Jul
(7) |
Aug
|
Sep
(2) |
Oct
(1) |
Nov
(6) |
Dec
|
2016 |
Jan
(12) |
Feb
(97) |
Mar
(57) |
Apr
(52) |
May
(33) |
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
(3) |
Nov
(3) |
Dec
|
2017 |
Jan
(4) |
Feb
|
Mar
(23) |
Apr
(5) |
May
|
Jun
(2) |
Jul
(3) |
Aug
(2) |
Sep
|
Oct
(6) |
Nov
(3) |
Dec
(3) |
2018 |
Jan
(4) |
Feb
(11) |
Mar
|
Apr
(1) |
May
(3) |
Jun
(6) |
Jul
|
Aug
(5) |
Sep
(5) |
Oct
(36) |
Nov
(128) |
Dec
(18) |
2019 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(24) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-03-04 17:51:19
|
Commit-ID: d4c67b1597349b2d01e61e211ec1267e4b17fc39 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=d4c67b1597349b2d01e61e211ec1267e4b17fc39 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Thu, 3 Mar 2016 21:37:37 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Thu, 3 Mar 2016 21:37:37 -0800 nsis: make nsis output automatically select architecture Make the NSIS output automatically select the output architecture to generate the proper filename and, much more importantly, set up the proper default install directory. This requires Perl as well as makensis to be present in order to make an installer, but that doesn't really seem like a too onerous of a requirement (NSIS being the big external dependency here.) Signed-off-by: H. Peter Anvin <hp...@zy...> --- .gitignore | 5 +- Makefile.in | 28 ++- nsis/MultiUser.nsh | 470 ++++++++++++++++++++++++++++++++++++++++++++++ nsis/getpearch.pl | 74 ++++++++ nasm.nsi => nsis/nasm.nsi | 49 +++-- 5 files changed, 592 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index 1fb29c2..f64b70a 100644 --- a/.gitignore +++ b/.gitignore @@ -47,8 +47,10 @@ TAGS /macros.c /nasm /nasm.man +/nasm.1 /ndisasm /ndisasm.man +/nasm.1 /pptok.c /pptok.h /pptok.ph @@ -76,7 +78,8 @@ TAGS /version.h /version.mac /version.mak -/version.nsh /version.sed /iflag.c /iflaggen.h +/nsis/version.nsh +/nsis/arch.nsh diff --git a/Makefile.in b/Makefile.in index 6ee17b4..5884012 100644 --- a/Makefile.in +++ b/Makefile.in @@ -34,6 +34,8 @@ NROFF = @NROFF@ ASCIIDOC = @ASCIIDOC@ XMLTO = @XMLTO@ +MAKENSIS = makensis + MKDIR = mkdir RM = rm @@ -53,7 +55,7 @@ endif .PHONY: all doc rdf install clean distclean cleaner spotless install_rdf test .PHONY: install_doc everything install_everything strip perlreq dist tags TAGS -.PHONY: manpages +.PHONY: manpages nsis .c.$(O): $(CC) -c $(ALL_CFLAGS) -o $@ $< @@ -70,7 +72,6 @@ endif .xml.1: $(XMLTO) man --skip-validation $< 2>/dev/null - #-- Begin File Lists --# NASM = nasm.$(O) nasmlib.$(O) ver.$(O) \ raa.$(O) saa.$(O) rbtree.$(O) \ @@ -100,7 +101,7 @@ NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) \ disp8.$(O) iflag.$(O) #-- End File Lists --# -all: nasm$(X) ndisasm$(X) manpages rdf +all: nasm$(X) ndisasm$(X) rdf nasm$(X): $(NASM) $(XOBJS) $(CC) $(LDFLAGS) -o nasm$(X) $(NASM) $(XOBJS) $(LIBS) @@ -139,8 +140,8 @@ version.sed: version version.pl $(PERL) $(srcdir)/version.pl sed < $(srcdir)/version > version.sed version.mak: version version.pl $(PERL) $(srcdir)/version.pl make < $(srcdir)/version > version.mak -version.nsh: version version.pl - $(PERL) $(srcdir)/version.pl nsis < $(srcdir)/version > version.nsh +nsis/version.nsh: version version.pl + $(PERL) $(srcdir)/version.pl nsis < $(srcdir)/version > nsis/version.nsh # This source file is generated from the standard macros file # `standard.mac' by another Perl script. Again, it's part of the @@ -195,10 +196,19 @@ PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \ regs.c regs.h regflags.c regdis.c regdis.h regvals.c \ tokhash.c tokens.h pptok.h pptok.c pptok.ph \ directiv.c directiv.h \ - version.h version.mac version.mak version.nsh \ - iflag.c iflaggen.h + iflag.c iflaggen.h \ + version.h version.mac version.mak nsis/version.nsh perlreq: $(PERLREQ) +# NSIS is not built except by explicit request, as it only applies to +# Windows platforms +nsis/arch.nsh: nsis/getpearch.pl nasm$(X) + $(PERL) $(srcdir)/nsis/getpearch.pl nasm$(X) > nsis/arch.nsh + +# Should only be done after "make everything" +nsis: nsis/nasm.nsi nsis/arch.nsh nsis/version.nsh + $(MAKENSIS) nsis/nasm.nsi + # Generated manpages, also pregenerated for distribution manpages: nasm.1 ndisasm.1 @@ -215,7 +225,9 @@ clean: $(RM) -f lib/*.$(O) lib/*.s lib/*.i $(RM) -f output/*.$(O) output/*.s output/*.i $(RM) -f nasm$(X) ndisasm$(X) + $(RM) -f nasm-*-installer-*.exe $(RM) -f tags TAGS + $(RM) -f nsis/arch.nsh cd rdoff && $(MAKE) clean distclean: clean @@ -261,7 +273,7 @@ doc: doc_install install_doc: cd doc && $(MAKE) install -everything: all doc rdf +everything: all manpages doc rdf install_everything: everything install install_doc install_rdf diff --git a/nsis/MultiUser.nsh b/nsis/MultiUser.nsh new file mode 100755 index 0000000..a04048a --- /dev/null +++ b/nsis/MultiUser.nsh @@ -0,0 +1,470 @@ +/* + +MultiUser.nsh + +Installer configuration for multi-user Windows environments + +Copyright 2008-2009 Joost Verburg +Updated 2016 by H. Peter Anvin to handle 64-bit Windows + +*/ + +!ifndef MULTIUSER_INCLUDED +!define MULTIUSER_INCLUDED +!verbose push +!verbose 3 + +;Standard NSIS header files + +!ifdef MULTIUSER_MUI + !include MUI2.nsh +!endif +!include nsDialogs.nsh +!include LogicLib.nsh +!include WinVer.nsh +!include FileFunc.nsh + +;Variables + +Var MultiUser.Privileges +Var MultiUser.InstallMode + +;Command line installation mode setting + +!ifdef MULTIUSER_INSTALLMODE_COMMANDLINE + !include StrFunc.nsh + !ifndef StrStr_INCLUDED + ${StrStr} + !endif + !ifndef MULTIUSER_NOUNINSTALL + !ifndef UnStrStr_INCLUDED + ${UnStrStr} + !endif + !endif + + Var MultiUser.Parameters + Var MultiUser.Result +!endif + +;Installation folder stored in registry + +!ifdef MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY & MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME + Var MultiUser.InstDir +!endif + +!ifdef MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY & MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME + Var MultiUser.DefaultKeyValue +!endif + +;Windows Vista UAC setting + +!if "${MULTIUSER_EXECUTIONLEVEL}" == Admin + RequestExecutionLevel admin + !define MULTIUSER_EXECUTIONLEVEL_ALLUSERS +!else if "${MULTIUSER_EXECUTIONLEVEL}" == Power + RequestExecutionLevel admin + !define MULTIUSER_EXECUTIONLEVEL_ALLUSERS +!else if "${MULTIUSER_EXECUTIONLEVEL}" == Highest + RequestExecutionLevel highest + !define MULTIUSER_EXECUTIONLEVEL_ALLUSERS +!else + RequestExecutionLevel user +!endif + +/* + +Install modes + +*/ + +!macro MULTIUSER_INSTALLMODE_ALLUSERS UNINSTALLER_PREFIX UNINSTALLER_FUNCPREFIX + + ;Install mode initialization - per-machine + + ${ifnot} ${IsNT} + ${orif} $MultiUser.Privileges == "Admin" + ${orif} $MultiUser.Privileges == "Power" + + StrCpy $MultiUser.InstallMode AllUsers + + SetShellVarContext all + + !if "${UNINSTALLER_PREFIX}" != UN + ;Set default installation location for installer + !ifdef MULTIUSER_INSTALLMODE_INSTDIR + StrCpy $INSTDIR "${GLOBALINSTDIR}\${MULTIUSER_INSTALLMODE_INSTDIR}" + !endif + !endif + + !ifdef MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY & MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME + + ReadRegStr $MultiUser.InstDir HKLM "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY}" "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME}" + + ${if} $MultiUser.InstDir != "" + StrCpy $INSTDIR $MultiUser.InstDir + ${endif} + + !endif + + !ifdef MULTIUSER_INSTALLMODE_${UNINSTALLER_PREFIX}FUNCTION + Call "${MULTIUSER_INSTALLMODE_${UNINSTALLER_PREFIX}FUNCTION}" + !endif + + ${endif} + +!macroend + +!macro MULTIUSER_INSTALLMODE_CURRENTUSER UNINSTALLER_PREFIX UNINSTALLER_FUNCPREFIX + + ;Install mode initialization - per-user + + ${if} ${IsNT} + + StrCpy $MultiUser.InstallMode CurrentUser + + SetShellVarContext current + + !if "${UNINSTALLER_PREFIX}" != UN + ;Set default installation location for installer + !ifdef MULTIUSER_INSTALLMODE_INSTDIR + ${if} ${AtLeastWin2000} + StrCpy $INSTDIR "$LOCALAPPDATA\bin\${MULTIUSER_INSTALLMODE_INSTDIR}" + ${else} + StrCpy $INSTDIR "${GLOBALINSTDIR}\${MULTIUSER_INSTALLMODE_INSTDIR}" + ${endif} + !endif + !endif + + !ifdef MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY & MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME + + ReadRegStr $MultiUser.InstDir HKCU "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY}" "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME}" + + ${if} $MultiUser.InstDir != "" + StrCpy $INSTDIR $MultiUser.InstDir + ${endif} + + !endif + + !ifdef MULTIUSER_INSTALLMODE_${UNINSTALLER_PREFIX}FUNCTION + Call "${MULTIUSER_INSTALLMODE_${UNINSTALLER_PREFIX}FUNCTION}" + !endif + + ${endif} + +!macroend + +Function MultiUser.InstallMode.AllUsers + !insertmacro MULTIUSER_INSTALLMODE_ALLUSERS "" "" +FunctionEnd + +Function MultiUser.InstallMode.CurrentUser + !insertmacro MULTIUSER_INSTALLMODE_CURRENTUSER "" "" +FunctionEnd + +!ifndef MULTIUSER_NOUNINSTALL + +Function un.MultiUser.InstallMode.AllUsers + !insertmacro MULTIUSER_INSTALLMODE_ALLUSERS UN .un +FunctionEnd + +Function un.MultiUser.InstallMode.CurrentUser + !insertmacro MULTIUSER_INSTALLMODE_CURRENTUSER UN .un +FunctionEnd + +!endif + +/* + +Installer/uninstaller initialization + +*/ + +!macro MULTIUSER_INIT_QUIT UNINSTALLER_FUNCPREFIX + + !ifdef MULTIUSER_INIT_${UNINSTALLER_FUNCPREFIX}FUNCTIONQUIT + Call "${MULTIUSER_INIT_${UNINSTALLER_FUNCPREFIX}FUCTIONQUIT} + !else + Quit + !endif + +!macroend + +!macro MULTIUSER_INIT_TEXTS + + !ifndef MULTIUSER_INIT_TEXT_ADMINREQUIRED + !define MULTIUSER_INIT_TEXT_ADMINREQUIRED "$(^Caption) requires Administrator priviledges." + !endif + + !ifndef MULTIUSER_INIT_TEXT_POWERREQUIRED + !define MULTIUSER_INIT_TEXT_POWERREQUIRED "$(^Caption) requires at least Power User priviledges." + !endif + + !ifndef MULTIUSER_INIT_TEXT_ALLUSERSNOTPOSSIBLE + !define MULTIUSER_INIT_TEXT_ALLUSERSNOTPOSSIBLE "Your user account does not have sufficient privileges to install $(^Name) for all users of this compuetr." + !endif + +!macroend + +!macro MULTIUSER_INIT_CHECKS UNINSTALLER_PREFIX UNINSTALLER_FUNCPREFIX + + ;Installer initialization - check privileges and set install mode + + !insertmacro MULTIUSER_INIT_TEXTS + + UserInfo::GetAccountType + Pop $MultiUser.Privileges + + ${if} ${IsNT} + + ;Check privileges + + !if "${MULTIUSER_EXECUTIONLEVEL}" == Admin + + ${if} $MultiUser.Privileges != "Admin" + MessageBox MB_OK|MB_ICONSTOP "${MULTIUSER_INIT_TEXT_ADMINREQUIRED}" + !insertmacro MULTIUSER_INIT_QUIT "${UNINSTALLER_FUNCPREFIX}" + ${endif} + + !else if "${MULTIUSER_EXECUTIONLEVEL}" == Power + + ${if} $MultiUser.Privileges != "Power" + ${andif} $MultiUser.Privileges != "Admin" + ${if} ${AtMostWinXP} + MessageBox MB_OK|MB_ICONSTOP "${MULTIUSER_INIT_TEXT_POWERREQUIRED}" + ${else} + MessageBox MB_OK|MB_ICONSTOP "${MULTIUSER_INIT_TEXT_ADMINREQUIRED}" + ${endif} + !insertmacro MULTIUSER_INIT_QUIT "${UNINSTALLER_FUNCPREFIX}" + ${endif} + + !endif + + !ifdef MULTIUSER_EXECUTIONLEVEL_ALLUSERS + + ;Default to per-machine installation if possible + + ${if} $MultiUser.Privileges == "Admin" + ${orif} $MultiUser.Privileges == "Power" + !ifndef MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER + Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.AllUsers + !else + Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser + !endif + + !ifdef MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY & MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME + + ;Set installation mode to setting from a previous installation + + !ifndef MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER + ReadRegStr $MultiUser.DefaultKeyValue HKLM "${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY}" "${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME}" + ${if} $MultiUser.DefaultKeyValue == "" + ReadRegStr $MultiUser.DefaultKeyValue HKCU "${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY}" "${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME}" + ${if} $MultiUser.DefaultKeyValue != "" + Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser + ${endif} + ${endif} + !else + ReadRegStr $MultiUser.DefaultKeyValue HKCU "${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY}" "${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME}" + ${if} $MultiUser.DefaultKeyValue == "" + ReadRegStr $MultiUser.DefaultKeyValue HKLM "${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY}" "${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME}" + ${if} $MultiUser.DefaultKeyValue != "" + Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.AllUsers + ${endif} + ${endif} + !endif + + !endif + + ${else} + Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser + ${endif} + + !else + + Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser + + !endif + + !ifdef MULTIUSER_INSTALLMODE_COMMANDLINE + + ;Check for install mode setting on command line + + ${${UNINSTALLER_FUNCPREFIX}GetParameters} $MultiUser.Parameters + + ${${UNINSTALLER_PREFIX}StrStr} $MultiUser.Result $MultiUser.Parameters "/CurrentUser" + + ${if} $MultiUser.Result != "" + Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser + ${endif} + + ${${UNINSTALLER_PREFIX}StrStr} $MultiUser.Result $MultiUser.Parameters "/AllUsers" + + ${if} $MultiUser.Result != "" + ${if} $MultiUser.Privileges == "Admin" + ${orif} $MultiUser.Privileges == "Power" + Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.AllUsers + ${else} + MessageBox MB_OK|MB_ICONSTOP "${MULTIUSER_INIT_TEXT_ALLUSERSNOTPOSSIBLE}" + ${endif} + ${endif} + + !endif + + ${else} + + ;Not running Windows NT, per-user installation not supported + + Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.AllUsers + + ${endif} + +!macroend + +!macro MULTIUSER_INIT + !verbose push + !verbose 3 + + !insertmacro MULTIUSER_INIT_CHECKS "" "" + + !verbose pop +!macroend + +!ifndef MULTIUSER_NOUNINSTALL + +!macro MULTIUSER_UNINIT + !verbose push + !verbose 3 + + !insertmacro MULTIUSER_INIT_CHECKS Un un. + + !verbose pop +!macroend + +!endif + +/* + +Modern UI 2 page + +*/ + +!ifdef MULTIUSER_MUI + +!macro MULTIUSER_INSTALLMODEPAGE_INTERFACE + + !ifndef MULTIUSER_INSTALLMODEPAGE_INTERFACE + !define MULTIUSER_INSTALLMODEPAGE_INTERFACE + Var MultiUser.InstallModePage + + Var MultiUser.InstallModePage.Text + + Var MultiUser.InstallModePage.AllUsers + Var MultiUser.InstallModePage.CurrentUser + + Var MultiUser.InstallModePage.ReturnValue + !endif + +!macroend + +!macro MULTIUSER_PAGEDECLARATION_INSTALLMODE + + !insertmacro MUI_SET MULTIUSER_${MUI_PAGE_UNINSTALLER_PREFIX}INSTALLMODEPAGE "" + !insertmacro MULTIUSER_INSTALLMODEPAGE_INTERFACE + + !insertmacro MUI_DEFAULT MULTIUSER_INSTALLMODEPAGE_TEXT_TOP "$(MULTIUSER_INNERTEXT_INSTALLMODE_TOP)" + !insertmacro MUI_DEFAULT MULTIUSER_INSTALLMODEPAGE_TEXT_ALLUSERS "$(MULTIUSER_INNERTEXT_INSTALLMODE_ALLUSERS)" + !insertmacro MUI_DEFAULT MULTIUSER_INSTALLMODEPAGE_TEXT_CURRENTUSER "$(MULTIUSER_INNERTEXT_INSTALLMODE_CURRENTUSER)" + + PageEx custom + + PageCallbacks MultiUser.InstallModePre_${MUI_UNIQUEID} MultiUser.InstallModeLeave_${MUI_UNIQUEID} + + Caption " " + + PageExEnd + + !insertmacro MULTIUSER_FUNCTION_INSTALLMODEPAGE MultiUser.InstallModePre_${MUI_UNIQUEID} MultiUser.InstallModeLeave_${MUI_UNIQUEID} + + !undef MULTIUSER_INSTALLMODEPAGE_TEXT_TOP + !undef MULTIUSER_INSTALLMODEPAGE_TEXT_ALLUSERS + !undef MULTIUSER_INSTALLMODEPAGE_TEXT_CURRENTUSER + +!macroend + +!macro MULTIUSER_PAGE_INSTALLMODE + + ;Modern UI page for install mode + + !verbose push + !verbose 3 + + !ifndef MULTIUSER_EXECUTIONLEVEL_ALLUSERS + !error "A mixed-mode installation requires MULTIUSER_EXECUTIONLEVEL to be set to Admin, Power or Highest." + !endif + + !insertmacro MUI_PAGE_INIT + !insertmacro MULTIUSER_PAGEDECLARATION_INSTALLMODE + + !verbose pop + +!macroend + +!macro MULTIUSER_FUNCTION_INSTALLMODEPAGE PRE LEAVE + + ;Page functions of Modern UI page + + Function "${PRE}" + + ${ifnot} ${IsNT} + Abort + ${endif} + + ${if} $MultiUser.Privileges != "Power" + ${andif} $MultiUser.Privileges != "Admin" + Abort + ${endif} + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM PRE + !insertmacro MUI_HEADER_TEXT_PAGE $(MULTIUSER_TEXT_INSTALLMODE_TITLE) $(MULTIUSER_TEXT_INSTALLMODE_SUBTITLE) + + nsDialogs::Create 1018 + Pop $MultiUser.InstallModePage + + ${NSD_CreateLabel} 0u 0u 300u 20u "${MULTIUSER_INSTALLMODEPAGE_TEXT_TOP}" + Pop $MultiUser.InstallModePage.Text + + ${NSD_CreateRadioButton} 20u 50u 280u 10u "${MULTIUSER_INSTALLMODEPAGE_TEXT_ALLUSERS}" + Pop $MultiUser.InstallModePage.AllUsers + + ${NSD_CreateRadioButton} 20u 70u 280u 10u "${MULTIUSER_INSTALLMODEPAGE_TEXT_CURRENTUSER}" + Pop $MultiUser.InstallModePage.CurrentUser + + ${if} $MultiUser.InstallMode == "AllUsers" + SendMessage $MultiUser.InstallModePage.AllUsers ${BM_SETCHECK} ${BST_CHECKED} 0 + ${else} + SendMessage $MultiUser.InstallModePage.CurrentUser ${BM_SETCHECK} ${BST_CHECKED} 0 + ${endif} + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW + nsDialogs::Show + + FunctionEnd + + Function "${LEAVE}" + SendMessage $MultiUser.InstallModePage.AllUsers ${BM_GETCHECK} 0 0 $MultiUser.InstallModePage.ReturnValue + + ${if} $MultiUser.InstallModePage.ReturnValue = ${BST_CHECKED} + Call MultiUser.InstallMode.AllUsers + ${else} + Call MultiUser.InstallMode.CurrentUser + ${endif} + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM LEAVE + FunctionEnd + +!macroend + +!endif + +!verbose pop +!endif diff --git a/nsis/getpearch.pl b/nsis/getpearch.pl new file mode 100644 index 0000000..2515553 --- /dev/null +++ b/nsis/getpearch.pl @@ -0,0 +1,74 @@ +#!/usr/bin/perl +# +# Get the appropriate variables to make an NSIS installer file +# based on the PE architecture of a specific file +# + +use strict; + +my %archnames = ( + 0x01de => 'am33', + 0x8664 => 'x64', + 0x01c0 => 'arm32', + 0x01c4 => 'thumb', + 0xaa64 => 'arm64', + 0x0ebc => 'efi', + 0x014c => 'x86', + 0x0200 => 'ia64', + 0x9041 => 'm32r', + 0x0266 => 'mips16', + 0x0366 => 'mips', + 0x0466 => 'mips16', + 0x01f0 => 'powerpc', + 0x01f1 => 'powerpc', + 0x0166 => 'mips', + 0x01a2 => 'sh3', + 0x01a3 => 'sh3', + 0x01a6 => 'sh4', + 0x01a8 => 'sh5', + 0x01c2 => 'arm32', + 0x0169 => 'wcemipsv2' +); + +my ($file) = @ARGV; +open(my $fh, '<', $file) + or die "$0: cannot open file: $file: $!\n"; + +read($fh, my $mz, 2); +exit 0 if ($mz ne 'MZ'); + +exit 0 unless (seek($fh, 0x3c, 0)); +exit 0 unless (read($fh, my $pe_offset, 1) == 1); +$pe_offset = unpack("C", $pe_offset); + +exit 0 unless (seek($fh, $pe_offset, 0)); +read($fh, my $pe, 4); +exit 0 unless ($pe eq "PE\0\0"); + +exit 0 unless (read($fh, my $arch, 2) == 2); +$arch = $archnames{unpack("v", $arch)}; +if (defined($arch)) { + print "!define ARCH ${arch}\n"; +} + +exit 0 unless (seek($fh, 14, 1)); +exit 0 unless (read($fh, my $auxheaderlen, 2) == 2); +exit 0 unless (unpack("v", $auxheaderlen) >= 2); + +exit 0 unless (seek($fh, 2, 1)); +exit 0 unless (read($fh, my $petype, 2) == 2); +$petype = unpack("v", $petype); +if ($petype == 0x010b) { + # It is a 32-bit PE32 file + print "!define BITS 32\n"; + print "!define GLOBALINSTDIR \$PROGRAMFILES\n"; +} elsif ($petype == 0x020b) { + # It is a 64-bit PE32+ file + print "!define BITS 64\n"; + print "!define GLOBALINSTDIR \$PROGRAMFILES64\n"; +} else { + # No idea... +} + +close($fh); +exit 0; diff --git a/nasm.nsi b/nsis/nasm.nsi similarity index 90% rename from nasm.nsi rename to nsis/nasm.nsi index 7daea6c..4241103 100644 --- a/nasm.nsi +++ b/nsis/nasm.nsi @@ -27,6 +27,8 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. !include "version.nsh" +!include /nonfatal "arch.nsh" + !define PRODUCT_NAME "Netwide Assembler" !define PRODUCT_SHORT_NAME "nasm" !define PACKAGE_NAME "${PRODUCT_NAME} ${VERSION}" @@ -37,8 +39,8 @@ SetCompressor lzma !define MULTIUSER_EXECUTIONLEVEL Highest !define MULTIUSER_MUI !define MULTIUSER_INSTALLMODE_COMMANDLINE -!define MULTIUSER_INSTALLMODE_INSTDIR "${PRODUCT_SHORT_NAME}" -!include MultiUser.nsh +!define MULTIUSER_INSTALLMODE_INSTDIR "NASM" +!include "MultiUser.nsh" !insertmacro MULTIUSER_PAGE_INSTALLMODE !insertmacro MULTIUSER_INSTALLMODEPAGE_INTERFACE @@ -48,7 +50,7 @@ SetCompressor lzma ;Name and file Name "${PACKAGE_NAME}" -OutFile "${PACKAGE_SHORT_NAME}-installer.exe" +OutFile "../${PACKAGE_SHORT_NAME}-installer-${ARCH}.exe" ;Get installation folder from registry if available InstallDirRegKey HKCU "Software\${PRODUCT_SHORT_NAME}" "" @@ -65,8 +67,8 @@ Var CmdFailed ;-------------------------------- ;Interface Settings Caption "${PACKAGE_SHORT_NAME} installation" -Icon "nsis/nasm.ico" -UninstallIcon "nsis/nasm-un.ico" +Icon "nasm.ico" +UninstallIcon "nasm-un.ico" !define MUI_ABORTWARNING @@ -96,10 +98,10 @@ UninstallIcon "nsis/nasm-un.ico" Section "NASM" SecNasm Sectionin RO SetOutPath "$INSTDIR" - File "LICENSE" - File "nasm.exe" - File "ndisasm.exe" - File "nsis/nasm.ico" + File "../LICENSE" + File "../nasm.exe" + File "../ndisasm.exe" + File "nasm.ico" ;Store installation folder WriteRegStr HKCU "Software\${PRODUCT_SHORT_NAME}" "" $INSTDIR @@ -135,30 +137,27 @@ skip: SectionEnd Section "RDOFF" SecRdoff - CreateDirectory "$INSTDIR\rdoff" - SetOutPath "$INSTDIR\rdoff" - File "rdoff/ldrdf.exe" - File "rdoff/rdf2bin.exe" - File "rdoff/rdf2com.exe" - File "rdoff/rdf2ith.exe" - File "rdoff/rdf2ihx.exe" - File "rdoff/rdf2srec.exe" - File "rdoff/rdfdump.exe" - File "rdoff/rdflib.exe" - File "rdoff/rdx.exe" + File "../rdoff/ldrdf.exe" + File "../rdoff/rdf2bin.exe" + File "../rdoff/rdf2com.exe" + File "../rdoff/rdf2ith.exe" + File "../rdoff/rdf2ihx.exe" + File "../rdoff/rdf2srec.exe" + File "../rdoff/rdfdump.exe" + File "../rdoff/rdflib.exe" SectionEnd Section "Manual" SecManual SetOutPath "$INSTDIR" - File "doc/nasmdoc.pdf" + File "../doc/nasmdoc.pdf" CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Manual.lnk" "$INSTDIR\nasmdoc.pdf" SectionEnd Section "VS8 integration" SecVS8 - CreateDirectory "$INSTDIR\contrib\VSrules" - SetOutPath "$INSTDIR\contrib\VSrules" - File "contrib/VSrules/nasm.README" - File "contrib/VSrules/nasm.rules" + CreateDirectory "$INSTDIR\VSrules" + SetOutPath "$INSTDIR\VSrules" + File "../contrib/VSrules/nasm.README" + File "../contrib/VSrules/nasm.rules" SectionEnd ;-------------------------------- |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-03-04 17:51:19
|
Commit-ID: 3a27b17c7fea3845c63864e11008edf8cebd7e17 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=3a27b17c7fea3845c63864e11008edf8cebd7e17 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Thu, 3 Mar 2016 17:11:28 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Thu, 3 Mar 2016 17:18:38 -0800 Replace external dependencies on <ctype.h> with an internal table Don't rely on the platform <ctype.h>; hopefully this can avoid problems. Signed-off-by: H. Peter Anvin <hp...@zy...> --- Makefile.in | 9 +-- Mkfiles/msvc.mak | 9 +-- Mkfiles/netware.mak | 11 ++-- Mkfiles/openwcom.mak | 9 +-- Mkfiles/owlinux.mak | 9 +-- ctype.c | 181 +++++++++++++++++++++++++++++++++++++++++++++++++++ eval.c | 1 - float.c | 1 - listing.c | 1 - misc/omfdump.c | 1 - nasm.c | 3 - nasm.h | 21 ++---- nasmlib.c | 16 ----- nasmlib.h | 23 +++---- ndisasm.c | 2 - output/outaout.c | 1 - output/outas86.c | 1 - output/outbin.c | 1 - output/outcoff.c | 1 - output/outdbg.c | 1 - output/outelf32.c | 1 - output/outelf64.c | 1 - output/outelfx32.c | 1 - output/outieee.c | 3 +- output/outmacho.c | 1 - output/outobj.c | 3 +- output/outrdf2.c | 1 - output/stabs.h | 1 - parser.c | 1 - pptok.pl | 1 - preproc-nop.c | 1 - preproc.c | 1 - rdoff/Makefile.in | 2 +- rdoff/rdf2bin.c | 3 +- rdoff/rdlar.c | 1 - stdscan.c | 1 - 36 files changed, 228 insertions(+), 97 deletions(-) diff --git a/Makefile.in b/Makefile.in index 6ee17b4..9b274c7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -72,7 +72,7 @@ endif #-- Begin File Lists --# -NASM = nasm.$(O) nasmlib.$(O) ver.$(O) \ +NASM = nasm.$(O) nasmlib.$(O) ctype.$(O) ver.$(O) \ raa.$(O) saa.$(O) rbtree.$(O) \ realpath.$(O) \ float.$(O) insnsa.$(O) insnsb.$(O) \ @@ -95,7 +95,7 @@ NASM = nasm.$(O) nasmlib.$(O) ver.$(O) \ disp8.$(O) \ iflag.$(O) -NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) \ +NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ctype.$(O) ver.$(O) \ insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O) \ disp8.$(O) iflag.$(O) #-- End File Lists --# @@ -307,6 +307,7 @@ assemble.$(O): assemble.c assemble.h compiler.h config.h directiv.h disp8.h \ iflag.h iflaggen.h insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h \ preproc.h regs.h tables.h tokens.h crc64.$(O): crc64.c compiler.h config.h hashtbl.h nasmlib.h +ctype.$(O): ctype.c compiler.h config.h nasmlib.h directiv.$(O): directiv.c compiler.h config.h directiv.h hashtbl.h insnsi.h \ nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h disasm.$(O): disasm.c compiler.h config.h directiv.h disasm.h disp8.h \ @@ -344,7 +345,7 @@ listing.$(O): listing.c compiler.h config.h directiv.h insnsi.h listing.h \ macros.$(O): macros.c compiler.h config.h directiv.h hashtbl.h insnsi.h \ nasm.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h \ tables.h -md5c.$(O): md5c.c md5.h +md5c.$(O): md5c.c compiler.h config.h md5.h nasm.$(O): nasm.c assemble.h compiler.h config.h directiv.h eval.h float.h \ iflag.h iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h \ opflags.h output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h \ @@ -405,7 +406,7 @@ output/outlib.$(O): output/outlib.c compiler.h config.h directiv.h insnsi.h \ tables.h output/outmacho.$(O): output/outmacho.c compiler.h config.h directiv.h \ insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \ - pptok.h preproc.h raa.h regs.h saa.h tables.h + pptok.h preproc.h raa.h rbtree.h regs.h saa.h tables.h output/outobj.$(O): output/outobj.c compiler.h config.h directiv.h eval.h \ insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \ pptok.h preproc.h regs.h stdscan.h tables.h diff --git a/Mkfiles/msvc.mak b/Mkfiles/msvc.mak index a1bfd5e..1a6f087 100644 --- a/Mkfiles/msvc.mak +++ b/Mkfiles/msvc.mak @@ -43,7 +43,7 @@ X = .exe #-- Begin File Lists --# # Edit in Makefile.in, not here! -NASM = nasm.$(O) nasmlib.$(O) ver.$(O) \ +NASM = nasm.$(O) nasmlib.$(O) ctype.$(O) ver.$(O) \ raa.$(O) saa.$(O) rbtree.$(O) \ realpath.$(O) \ float.$(O) insnsa.$(O) insnsb.$(O) \ @@ -66,7 +66,7 @@ NASM = nasm.$(O) nasmlib.$(O) ver.$(O) \ disp8.$(O) \ iflag.$(O) -NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) \ +NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ctype.$(O) ver.$(O) \ insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O) \ disp8.$(O) iflag.$(O) #-- End File Lists --# @@ -229,6 +229,7 @@ assemble.$(O): assemble.c assemble.h compiler.h directiv.h disp8.h iflag.h \ iflaggen.h insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h \ regs.h tables.h tokens.h crc64.$(O): crc64.c compiler.h hashtbl.h nasmlib.h +ctype.$(O): ctype.c compiler.h nasmlib.h directiv.$(O): directiv.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \ nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h disasm.$(O): disasm.c compiler.h directiv.h disasm.h disp8.h iflag.h \ @@ -265,7 +266,7 @@ listing.$(O): listing.c compiler.h directiv.h insnsi.h listing.h nasm.h \ nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h macros.$(O): macros.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \ nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h -md5c.$(O): md5c.c md5.h +md5c.$(O): md5c.c compiler.h md5.h nasm.$(O): nasm.c assemble.h compiler.h directiv.h eval.h float.h iflag.h \ iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h \ output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h \ @@ -321,7 +322,7 @@ output/outlib.$(O): output/outlib.c compiler.h directiv.h insnsi.h nasm.h \ nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h tables.h output/outmacho.$(O): output/outmacho.c compiler.h directiv.h insnsi.h \ nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \ - preproc.h raa.h regs.h saa.h tables.h + preproc.h raa.h rbtree.h regs.h saa.h tables.h output/outobj.$(O): output/outobj.c compiler.h directiv.h eval.h insnsi.h \ nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \ preproc.h regs.h stdscan.h tables.h diff --git a/Mkfiles/netware.mak b/Mkfiles/netware.mak index d897f44..8be9227 100644 --- a/Mkfiles/netware.mak +++ b/Mkfiles/netware.mak @@ -30,7 +30,7 @@ O = o #-- Begin File Lists --# # Edit in Makefile.in, not here! -NASM = nasm.o nasmlib.o ver.o \ +NASM = nasm.o nasmlib.o ctype.o ver.o \ raa.o saa.o rbtree.o \ realpath.o \ float.o insnsa.o insnsb.o \ @@ -53,7 +53,7 @@ NASM = nasm.o nasmlib.o ver.o \ disp8.o \ iflag.o -NDISASM = ndisasm.o disasm.o sync.o nasmlib.o ver.o \ +NDISASM = ndisasm.o disasm.o sync.o nasmlib.o ctype.o ver.o \ insnsd.o insnsb.o insnsn.o regs.o regdis.o \ disp8.o iflag.o #-- End File Lists --# @@ -137,6 +137,7 @@ assemble.o: assemble.c assemble.h compiler.h config.h directiv.h disp8.h \ iflag.h iflaggen.h insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h \ preproc.h regs.h tables.h tokens.h crc64.o: crc64.c compiler.h config.h hashtbl.h nasmlib.h +ctype.o: ctype.c compiler.h config.h nasmlib.h directiv.o: directiv.c compiler.h config.h directiv.h hashtbl.h insnsi.h \ nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h disasm.o: disasm.c compiler.h config.h directiv.h disasm.h disp8.h iflag.h \ @@ -173,7 +174,7 @@ listing.o: listing.c compiler.h config.h directiv.h insnsi.h listing.h \ nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h macros.o: macros.c compiler.h config.h directiv.h hashtbl.h insnsi.h nasm.h \ nasmlib.h opflags.h outform.h pptok.h preproc.h regs.h tables.h -md5c.o: md5c.c md5.h +md5c.o: md5c.c compiler.h config.h md5.h nasm.o: nasm.c assemble.h compiler.h config.h directiv.h eval.h float.h \ iflag.h iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h \ opflags.h outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h \ @@ -224,8 +225,8 @@ outieee.o: outieee.c compiler.h config.h directiv.h insnsi.h nasm.h \ outlib.o: outlib.c compiler.h config.h directiv.h insnsi.h nasm.h nasmlib.h \ opflags.h outlib.h pptok.h preproc.h regs.h tables.h outmacho.o: outmacho.c compiler.h config.h directiv.h insnsi.h nasm.h \ - nasmlib.h opflags.h outform.h outlib.h pptok.h preproc.h raa.h regs.h saa.h \ - tables.h + nasmlib.h opflags.h outform.h outlib.h pptok.h preproc.h raa.h rbtree.h \ + regs.h saa.h tables.h outobj.o: outobj.c compiler.h config.h directiv.h eval.h insnsi.h nasm.h \ nasmlib.h opflags.h outform.h outlib.h pptok.h preproc.h regs.h stdscan.h \ tables.h diff --git a/Mkfiles/openwcom.mak b/Mkfiles/openwcom.mak index 351df72..2e2f22f 100644 --- a/Mkfiles/openwcom.mak +++ b/Mkfiles/openwcom.mak @@ -46,7 +46,7 @@ X = .exe #-- Begin File Lists --# # Edit in Makefile.in, not here! -NASM = nasm.$(O) nasmlib.$(O) ver.$(O) & +NASM = nasm.$(O) nasmlib.$(O) ctype.$(O) ver.$(O) & raa.$(O) saa.$(O) rbtree.$(O) & realpath.$(O) & float.$(O) insnsa.$(O) insnsb.$(O) & @@ -69,7 +69,7 @@ NASM = nasm.$(O) nasmlib.$(O) ver.$(O) & disp8.$(O) & iflag.$(O) -NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) & +NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ctype.$(O) ver.$(O) & insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O) & disp8.$(O) iflag.$(O) #-- End File Lists --# @@ -274,6 +274,7 @@ assemble.$(O): assemble.c assemble.h compiler.h config.h directiv.h disp8.h & iflag.h iflaggen.h insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h & preproc.h regs.h tables.h tokens.h crc64.$(O): crc64.c compiler.h config.h hashtbl.h nasmlib.h +ctype.$(O): ctype.c compiler.h config.h nasmlib.h directiv.$(O): directiv.c compiler.h config.h directiv.h hashtbl.h insnsi.h & nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h disasm.$(O): disasm.c compiler.h config.h directiv.h disasm.h disp8.h & @@ -311,7 +312,7 @@ listing.$(O): listing.c compiler.h config.h directiv.h insnsi.h listing.h & macros.$(O): macros.c compiler.h config.h directiv.h hashtbl.h insnsi.h & nasm.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h & tables.h -md5c.$(O): md5c.c md5.h +md5c.$(O): md5c.c compiler.h config.h md5.h nasm.$(O): nasm.c assemble.h compiler.h config.h directiv.h eval.h float.h & iflag.h iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h & opflags.h output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h & @@ -372,7 +373,7 @@ output/outlib.$(O): output/outlib.c compiler.h config.h directiv.h insnsi.h & tables.h output/outmacho.$(O): output/outmacho.c compiler.h config.h directiv.h & insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h & - pptok.h preproc.h raa.h regs.h saa.h tables.h + pptok.h preproc.h raa.h rbtree.h regs.h saa.h tables.h output/outobj.$(O): output/outobj.c compiler.h config.h directiv.h eval.h & insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h & pptok.h preproc.h regs.h stdscan.h tables.h diff --git a/Mkfiles/owlinux.mak b/Mkfiles/owlinux.mak index 256abba..1287842 100644 --- a/Mkfiles/owlinux.mak +++ b/Mkfiles/owlinux.mak @@ -57,7 +57,7 @@ X = .exe #-- Begin File Lists --# # Edit in Makefile.in, not here! -NASM = nasm.$(O) nasmlib.$(O) ver.$(O) \ +NASM = nasm.$(O) nasmlib.$(O) ctype.$(O) ver.$(O) \ raa.$(O) saa.$(O) rbtree.$(O) \ realpath.$(O) \ float.$(O) insnsa.$(O) insnsb.$(O) \ @@ -80,7 +80,7 @@ NASM = nasm.$(O) nasmlib.$(O) ver.$(O) \ disp8.$(O) \ iflag.$(O) -NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) \ +NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ctype.$(O) ver.$(O) \ insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O) \ disp8.$(O) iflag.$(O) #-- End File Lists --# @@ -243,6 +243,7 @@ assemble.$(O): assemble.c assemble.h compiler.h directiv.h disp8.h iflag.h \ iflaggen.h insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h \ regs.h tables.h tokens.h crc64.$(O): crc64.c compiler.h hashtbl.h nasmlib.h +ctype.$(O): ctype.c compiler.h nasmlib.h directiv.$(O): directiv.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \ nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h disasm.$(O): disasm.c compiler.h directiv.h disasm.h disp8.h iflag.h \ @@ -279,7 +280,7 @@ listing.$(O): listing.c compiler.h directiv.h insnsi.h listing.h nasm.h \ nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h macros.$(O): macros.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \ nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h -md5c.$(O): md5c.c md5.h +md5c.$(O): md5c.c compiler.h md5.h nasm.$(O): nasm.c assemble.h compiler.h directiv.h eval.h float.h iflag.h \ iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h \ output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h \ @@ -335,7 +336,7 @@ output/outlib.$(O): output/outlib.c compiler.h directiv.h insnsi.h nasm.h \ nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h tables.h output/outmacho.$(O): output/outmacho.c compiler.h directiv.h insnsi.h \ nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \ - preproc.h raa.h regs.h saa.h tables.h + preproc.h raa.h rbtree.h regs.h saa.h tables.h output/outobj.$(O): output/outobj.c compiler.h directiv.h eval.h insnsi.h \ nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \ preproc.h regs.h stdscan.h tables.h diff --git a/ctype.c b/ctype.c new file mode 100644 index 0000000..18a46ca --- /dev/null +++ b/ctype.c @@ -0,0 +1,181 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2016 The NASM Authors - All Rights Reserved + * See the file AUTHORS included with the NASM distribution for + * the specific copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following + * conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ----------------------------------------------------------------------- */ + +/* + * ctype.c + * + * Replacement for <ctype.h> + * + * We require that the input format is a superset of ASCII, so we + * might as well hard-code these rather than rely on the platform. + * This also avoids potential strangeness related to locale. + * + * We treat all bytes >= 0x80 as alphabetic. This is a hack but + * allows us to handle symbol names in Unicode or other extended + * character sets, although it will not support case conversion for + * those. It is as good as we can do without actually being + * multibyte-character aware. + */ + +#include "compiler.h" +#include "nasmlib.h" + +const unsigned char nasm_tolower_tab[256] = +{ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff +}; + +const unsigned char nasm_toupper_tab[256] = +{ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff +}; + +#define S 0x01 /* Space */ +#define A 0x62 /* Upper case alphabetic non-hex digit */ +#define X 0x6a /* Upper case alphabetic hex digit */ +#define a 0x62 /* Lower case alphabetic non-hex digit */ +#define x 0x6a /* Lower case alphabetic hex digit */ +#define T 0x62 /* Other character valid in all alpha tokens */ +#define D 0xcc /* Decimal digit */ +#define C 0x10 /* Control */ +#define Z 0x11 /* Control whitespace */ +#define P 0x00 /* Other printable symbol */ +#define F 0x60 /* Other char allowed to start ID */ +#define M 0x40 /* Other char allowed in ID */ +#define B 0x20 /* Character allowed inside {} */ +#define N (0x80|M) /* Other char allowed to start number (+M) */ + +const unsigned char nasm_ctype_tab[256] = +{ + C,C,C,C,C,C,C,C, Z,Z,Z,Z,Z,Z,C,C, C,C,C,C,C,C,C,C, C,C,C,C,C,C,C,C, + S,P,P,M,N,P,P,P, P,P,P,P,P,B,F,P, D,D,D,D,D,D,D,D, D,D,P,P,P,P,P,F, + F,X,X,X,X,X,X,A, A,A,A,A,A,A,A,A, A,A,A,A,A,A,A,A, A,A,A,P,P,P,P,T, + P,x,x,x,x,x,x,a, a,a,a,a,a,a,a,a, a,a,a,a,a,a,a,a, a,a,a,P,P,P,M,C, + + T,T,T,T,T,T,T,T, T,T,T,T,T,T,T,T, T,T,T,T,T,T,T,T, T,T,T,T,T,T,T,T, + T,T,T,T,T,T,T,T, T,T,T,T,T,T,T,T, T,T,T,T,T,T,T,T, T,T,T,T,T,T,T,T, + T,T,T,T,T,T,T,T, T,T,T,T,T,T,T,T, T,T,T,T,T,T,T,T, T,T,T,T,T,T,T,T, + T,T,T,T,T,T,T,T, T,T,T,T,T,T,T,T, T,T,T,T,T,T,T,T, T,T,T,T,T,T,T,T +}; diff --git a/eval.c b/eval.c index 72e13c9..e348e82 100644 --- a/eval.c +++ b/eval.c @@ -41,7 +41,6 @@ #include <stdlib.h> #include <stddef.h> #include <string.h> -#include <ctype.h> #include <inttypes.h> #include "nasm.h" diff --git a/float.c b/float.c index e30e1ef..6dddea9 100644 --- a/float.c +++ b/float.c @@ -37,7 +37,6 @@ #include "compiler.h" -#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/listing.c b/listing.c index fa85044..c1e566f 100644 --- a/listing.c +++ b/listing.c @@ -41,7 +41,6 @@ #include <stdlib.h> #include <stddef.h> #include <string.h> -#include <ctype.h> #include <inttypes.h> #include "nasm.h" diff --git a/misc/omfdump.c b/misc/omfdump.c index 322971e..85bc9ea 100644 --- a/misc/omfdump.c +++ b/misc/omfdump.c @@ -10,7 +10,6 @@ #include <stdio.h> #include <stdlib.h> #include <inttypes.h> -#include <ctype.h> #include <fcntl.h> #include <unistd.h> #include <sys/mman.h> diff --git a/nasm.c b/nasm.c index 0520500..437987e 100644 --- a/nasm.c +++ b/nasm.c @@ -41,7 +41,6 @@ #include <stdarg.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <inttypes.h> #include <limits.h> #include <time.h> @@ -336,8 +335,6 @@ int main(int argc, char **argv) error_file = stderr; - tolower_init(); - offsets = raa_init(); forwrefs = saa_init((int32_t)sizeof(struct forwrefinfo)); diff --git a/nasm.h b/nasm.h index ff2acfe..d50e615 100644 --- a/nasm.h +++ b/nasm.h @@ -428,25 +428,14 @@ extern struct preproc_ops preproc_nop; * decorator. E.g. {rn-sae}, {1to8}, {k1}{z} */ -#define isidstart(c) (nasm_isalpha(c) || \ - (c) == '_' || \ - (c) == '.' || \ - (c) == '?' || \ - (c) == '@') - -#define isidchar(c) (isidstart(c) || \ - nasm_isdigit(c) || \ - (c) == '$' || \ - (c) == '#' || \ - (c) == '~') - -#define isbrcchar(c) (isidchar(c) || \ - (c) == '-') +#define isidstart(c) ((nasm_ctype_tab[(unsigned char)c] & 0x60) >= 0x60) +#define isidchar(c) ((nasm_ctype_tab[(unsigned char)c] & 0x60) >= 0x40) +#define isbrcchar(c) ((nasm_ctype_tab[(unsigned char)c] & 0x60) >= 0x20) /* Ditto for numeric constants. */ -#define isnumstart(c) (nasm_isdigit(c) || (c) == '$') -#define isnumchar(c) (nasm_isalnum(c) || (c) == '_') +#define isnumstart(c) (!!(nasm_ctype_tab[(unsigned char)c] & 0x80)) +#define isnumchar(c) nasm_isalnum(c) /* * Data-type flags that get passed to listing-file routines. diff --git a/nasmlib.c b/nasmlib.c index a1a3191..d9315f7 100644 --- a/nasmlib.c +++ b/nasmlib.c @@ -40,7 +40,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <errno.h> #include <inttypes.h> @@ -54,21 +53,6 @@ vefunc nasm_verror; /* Global error handling function */ /* Uninitialized -> all zero by C spec */ const uint8_t zero_buffer[ZERO_BUF_SIZE]; -/* - * Prepare a table of tolower() results. This avoids function calls - * on some platforms. - */ - -unsigned char nasm_tolower_tab[256]; - -void tolower_init(void) -{ - int i; - - for (i = 0; i < 256; i++) - nasm_tolower_tab[i] = tolower(i); -} - void nasm_error(int severity, const char *fmt, ...) { va_list ap; diff --git a/nasmlib.h b/nasmlib.h index 96c488a..84efeb0 100644 --- a/nasmlib.h +++ b/nasmlib.h @@ -48,21 +48,22 @@ #endif /* - * tolower table -- avoids a function call on some platforms. - * NOTE: unlike the tolower() function in ctype, EOF is *NOT* + * tolower/toupper tables -- avoids a function call on some platforms. + * NOTE: unlike the to*() and is*() functions in ctype.h, EOF is *NOT* * a permitted value, for obvious reasons. */ -void tolower_init(void); -extern unsigned char nasm_tolower_tab[256]; +extern const unsigned char nasm_tolower_tab[256]; #define nasm_tolower(x) nasm_tolower_tab[(unsigned char)(x)] -/* Wrappers around <ctype.h> functions */ -/* These are only valid for values that cannot include EOF */ -#define nasm_isspace(x) isspace((unsigned char)(x)) -#define nasm_isalpha(x) isalpha((unsigned char)(x)) -#define nasm_isdigit(x) isdigit((unsigned char)(x)) -#define nasm_isalnum(x) isalnum((unsigned char)(x)) -#define nasm_isxdigit(x) isxdigit((unsigned char)(x)) +extern const unsigned char nasm_toupper_tab[256]; +#define nasm_toupper(x) nasm_toupper_tab[(unsigned char)(x)] + +extern const unsigned char nasm_ctype_tab[256]; +#define nasm_isspace(x) (!!(nasm_ctype_tab[(unsigned char)(x)] & 0x01)) +#define nasm_isalpha(x) (!!(nasm_ctype_tab[(unsigned char)(x)] & 0x02)) +#define nasm_isdigit(x) (!!(nasm_ctype_tab[(unsigned char)(x)] & 0x04)) +#define nasm_isalnum(x) (!!(nasm_ctype_tab[(unsigned char)(x)] & 0x06)) +#define nasm_isxdigit(x) (!!(nasm_ctype_tab[(unsigned char)(x)] & 0x08)) /* * ------------------------- diff --git a/ndisasm.c b/ndisasm.c index 754033c..644b9eb 100644 --- a/ndisasm.c +++ b/ndisasm.c @@ -41,7 +41,6 @@ #include <stdarg.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <errno.h> #include <inttypes.h> @@ -93,7 +92,6 @@ int main(int argc, char **argv) int32_t offset; FILE *fp; - tolower_init(); nasm_set_verror(ndisasm_verror); iflag_clear_all(&prefer); diff --git a/output/outaout.c b/output/outaout.c index 6604551..7d85986 100644 --- a/output/outaout.c +++ b/output/outaout.c @@ -41,7 +41,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <inttypes.h> #include "nasm.h" diff --git a/output/outas86.c b/output/outas86.c index 84e3035..0aa19fa 100644 --- a/output/outas86.c +++ b/output/outas86.c @@ -41,7 +41,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <inttypes.h> #include "nasm.h" diff --git a/output/outbin.c b/output/outbin.c index 915dc45..7b1eba8 100644 --- a/output/outbin.c +++ b/output/outbin.c @@ -78,7 +78,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <inttypes.h> #include "nasm.h" diff --git a/output/outcoff.c b/output/outcoff.c index 9587f35..33604e3 100644 --- a/output/outcoff.c +++ b/output/outcoff.c @@ -41,7 +41,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <time.h> #include <inttypes.h> diff --git a/output/outdbg.c b/output/outdbg.c index 034a615..f5013f2 100644 --- a/output/outdbg.c +++ b/output/outdbg.c @@ -41,7 +41,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <inttypes.h> #include "nasm.h" diff --git a/output/outelf32.c b/output/outelf32.c index 0af2420..4203cf5 100644 --- a/output/outelf32.c +++ b/output/outelf32.c @@ -41,7 +41,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <inttypes.h> #include <limits.h> diff --git a/output/outelf64.c b/output/outelf64.c index 5b4eee8..f99de65 100644 --- a/output/outelf64.c +++ b/output/outelf64.c @@ -41,7 +41,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <inttypes.h> #include "nasm.h" diff --git a/output/outelfx32.c b/output/outelfx32.c index 49ed945..3346896 100644 --- a/output/outelfx32.c +++ b/output/outelfx32.c @@ -41,7 +41,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <inttypes.h> #include "nasm.h" diff --git a/output/outieee.c b/output/outieee.c index 2415bc7..54ac42a 100644 --- a/output/outieee.c +++ b/output/outieee.c @@ -72,7 +72,6 @@ #include <string.h> #include <time.h> #include <stdarg.h> /* Note: we need the ANSI version of stdarg.h */ -#include <ctype.h> #include <inttypes.h> #include "nasm.h" @@ -1294,7 +1293,7 @@ static void ieee_unqualified_name(char *dest, char *source) { if (ieee_uppercase) { while (*source) - *dest++ = toupper(*source++); + *dest++ = nasm_toupper(*source++); *dest = 0; } else strcpy(dest, source); diff --git a/output/outmacho.c b/output/outmacho.c index b67561c..96c8fdd 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -41,7 +41,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <inttypes.h> #include "nasm.h" diff --git a/output/outobj.c b/output/outobj.c index 74f43ce..4c60591 100644 --- a/output/outobj.c +++ b/output/outobj.c @@ -41,7 +41,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <inttypes.h> #include <limits.h> @@ -428,7 +427,7 @@ static ObjRecord *obj_name(ObjRecord * orp, const char *name) orp->used += len + 1; if (obj_uppercase) while (--len >= 0) { - *ptr++ = toupper(*name); + *ptr++ = nasm_toupper(*name); name++; } else memcpy(ptr, name, len); diff --git a/output/outrdf2.c b/output/outrdf2.c index e6dcda9..a9dfa2e 100644 --- a/output/outrdf2.c +++ b/output/outrdf2.c @@ -42,7 +42,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <assert.h> #include <inttypes.h> diff --git a/output/stabs.h b/output/stabs.h index 3a09c41..3287d61 100644 --- a/output/stabs.h +++ b/output/stabs.h @@ -34,7 +34,6 @@ #ifndef STABS_H_ #define STABS_H_ -#include <ctype.h> #include <inttypes.h> #include "compiler.h" diff --git a/parser.c b/parser.c index 5107860..43ad9d3 100644 --- a/parser.c +++ b/parser.c @@ -41,7 +41,6 @@ #include <stdlib.h> #include <stddef.h> #include <string.h> -#include <ctype.h> #include <inttypes.h> #include "nasm.h" diff --git a/pptok.pl b/pptok.pl index 53a1c92..c8f33e1 100755 --- a/pptok.pl +++ b/pptok.pl @@ -180,7 +180,6 @@ if ($what eq 'c') { print OUT "#include \"compiler.h\"\n"; print OUT "#include <inttypes.h>\n"; - print OUT "#include <ctype.h>\n"; print OUT "#include \"nasmlib.h\"\n"; print OUT "#include \"hashtbl.h\"\n"; print OUT "#include \"preproc.h\"\n"; diff --git a/preproc-nop.c b/preproc-nop.c index 353e269..8ce0d4f 100644 --- a/preproc-nop.c +++ b/preproc-nop.c @@ -43,7 +43,6 @@ #include <stdarg.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <inttypes.h> #include <limits.h> #include <time.h> diff --git a/preproc.c b/preproc.c index b43cd61..9b99762 100644 --- a/preproc.c +++ b/preproc.c @@ -67,7 +67,6 @@ #include <stdlib.h> #include <stddef.h> #include <string.h> -#include <ctype.h> #include <limits.h> #include <inttypes.h> diff --git a/rdoff/Makefile.in b/rdoff/Makefile.in index 41fc5f1..9c9855a 100644 --- a/rdoff/Makefile.in +++ b/rdoff/Makefile.in @@ -32,7 +32,7 @@ MKDIR = mkdir LDRDFLIBS = rdoff.$(O) symtab.$(O) collectn.$(O) \ rdlib.$(O) segtab.$(O) hash.$(O) RDXLIBS = rdoff.$(O) rdfload.$(O) symtab.$(O) collectn.$(O) hash.$(O) -NASMLIB = ../nasmlib.$(O) +NASMLIB = ../nasmlib.$(O) ../ctype.$(O) # Binary suffixes O = @OBJEXT@ diff --git a/rdoff/rdf2bin.c b/rdoff/rdf2bin.c index 1e33075..555297c 100644 --- a/rdoff/rdf2bin.c +++ b/rdoff/rdf2bin.c @@ -40,7 +40,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <ctype.h> #include <errno.h> #include "rdfload.h" @@ -263,7 +262,7 @@ static const char *getformat(const char *pathname) if (!nasm_stricmp(p, "rdf2")) { const char *q = p+4; char *r = fmt_buf; - while (isalnum(*q) && r < fmt_buf+sizeof fmt_buf-1) + while (nasm_isalnum(*q) && r < fmt_buf+sizeof fmt_buf-1) *r++ = *q++; *r = '\0'; if (fmt_buf[0]) diff --git a/rdoff/rdlar.c b/rdoff/rdlar.c index 98b0f8f..81ff493 100644 --- a/rdoff/rdlar.c +++ b/rdoff/rdlar.c @@ -39,7 +39,6 @@ #include <stdio.h> #include <stdlib.h> -#include <ctype.h> #include <stdarg.h> #include <string.h> #include <errno.h> diff --git a/stdscan.c b/stdscan.c index ea7537d..76577ec 100644 --- a/stdscan.c +++ b/stdscan.c @@ -36,7 +36,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <inttypes.h> #include "nasm.h" |
From: nasm-bot f. C. G. <gor...@gm...> - 2016-03-04 17:48:17
|
Commit-ID: 92c02bb50df5a6489b618dd6a687ed8514762ecb Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=92c02bb50df5a6489b618dd6a687ed8514762ecb Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Fri, 4 Mar 2016 20:44:42 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Fri, 4 Mar 2016 20:44:42 +0300 listing: Don't try to open non-specified listing By default we setup @listname to '\0' and if has not been specified in command line it is passed in this form into list_init() which cause | [cyrill@uranus nasm.git] ./nasm -felf64 t.asm | nasm: error: unable to open listing file `' So make a proper test here. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- listing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/listing.c b/listing.c index fa85044..46a2cbf 100644 --- a/listing.c +++ b/listing.c @@ -128,7 +128,7 @@ static void list_emit(void) static void list_init(const char *fname) { - if (!fname) { + if (!fname || fname[0] == '\0') { listfp = NULL; return; } |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-03-04 01:06:16
|
Commit-ID: a9a1b5c318e7bcb7680483c51933c6f3d6c69cd9 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=a9a1b5c318e7bcb7680483c51933c6f3d6c69cd9 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Thu, 3 Mar 2016 17:05:20 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Thu, 3 Mar 2016 17:05:20 -0800 test: add test for cv8 structure bug (BR 3392342 and 3392343) Add test case for bugs 3392342 and 3392343. Signed-off-by: H. Peter Anvin <hp...@zy...> --- test/cv8struc.asm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/cv8struc.asm b/test/cv8struc.asm new file mode 100644 index 0000000..8d52cc3 --- /dev/null +++ b/test/cv8struc.asm @@ -0,0 +1,8 @@ +struc A_STRUC + ._a: resw 1 +endstruc + +a_struc: + istruc A_STRUC + at A_STRUC._a dw 1 + iend |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-03-03 23:27:28
|
Commit-ID: 215186fe82c461bc1ccef7bed5c1a1a0253bfcc9 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=215186fe82c461bc1ccef7bed5c1a1a0253bfcc9 Author: H. Peter Anvin <hp...@li...> AuthorDate: Wed, 17 Feb 2016 20:27:41 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Thu, 3 Mar 2016 15:22:03 -0800 Get rid of a bunch of unnecessary indirections We pass around a whole bunch of function pointers in arguments, which then just get stashed in static variables. Clean this mess up and in particular handle the error management in the preprocessor using nasm_set_verror() which already exists. Signed-off-by: H. Peter Anvin <hp...@li...> >From master branch checkin 130736c0cfcad28ee16cec6c14bb22999d982e5a Resolved Conflicts: nasm.c preproc-nop.c Signed-off-by: H. Peter Anvin <hp...@zy...> --- assemble.c | 185 ++++++++++++------------ assemble.h | 5 +- eval.c | 78 +++++----- eval.h | 3 +- float.c | 38 +++-- float.h | 3 +- listing.c | 17 ++- listing.h | 4 +- nasm.c | 35 ++--- nasm.h | 8 +- nasmlib.c | 7 +- nasmlib.h | 26 ++-- output/outaout.c | 5 +- output/outbin.c | 4 +- output/outelf32.c | 5 +- output/outelf64.c | 5 +- output/outelfx32.c | 5 +- output/outform.h | 1 - output/outobj.c | 2 +- parser.c | 15 +- preproc-nop.c | 9 +- preproc.c | 409 ++++++++++++++++++++++++++--------------------------- 22 files changed, 419 insertions(+), 450 deletions(-) diff --git a/assemble.c b/assemble.c index ed8b9f8..a26f2bf 100644 --- a/assemble.c +++ b/assemble.c @@ -227,9 +227,6 @@ typedef struct { (((mod) << 6) | (((reg) & 7) << 3) | ((rm) & 7)) static iflag_t cpu; /* cpu level received from nasm.c */ -static efunc errfunc; -static struct ofmt *outfmt; -static ListGen *list; static int64_t calcsize(int32_t, int64_t, int, insn *, const struct itemplate *); @@ -257,8 +254,8 @@ static int has_prefix(insn * ins, enum prefix_pos pos, int prefix) static void assert_no_prefix(insn * ins, enum prefix_pos pos) { if (ins->prefixes[pos]) - errfunc(ERR_NONFATAL, "invalid %s prefix", - prefix_name(ins->prefixes[pos])); + nasm_error(ERR_NONFATAL, "invalid %s prefix", + prefix_name(ins->prefixes[pos])); } static const char *size_name(int size) @@ -287,7 +284,7 @@ static const char *size_name(int size) static void warn_overflow(int pass, int size) { - errfunc(ERR_WARNING | pass | ERR_WARN_NOV, + nasm_error(ERR_WARNING | pass | ERR_WARN_NOV, "%s data exceeds bounds", size_name(size)); } @@ -340,7 +337,7 @@ static void out(int64_t offset, int32_t segto, const void *data, static char *lnfname = NULL; uint8_t p[8]; int asize = addrsize(type, size); /* Address size in bytes */ - const int amax = outfmt->maxbits >> 3; /* Maximum address size in bytes */ + const int amax = ofmt->maxbits >> 3; /* Maximum address size in bytes */ if (type == OUT_ADDRESS && segment == NO_SEG && wrt == NO_SEG) { /* @@ -350,7 +347,7 @@ static void out(int64_t offset, int32_t segto, const void *data, uint8_t *q = p; if (asize > 8) { - errfunc(ERR_PANIC, "OUT_ADDRESS with size > 8"); + nasm_error(ERR_PANIC, "OUT_ADDRESS with size > 8"); return; } @@ -361,7 +358,7 @@ static void out(int64_t offset, int32_t segto, const void *data, asize = 0; /* No longer an address */ } - list->output(offset, data, type, size); + nasmlist->output(offset, data, type, size); /* * this call to src_get determines when we call the @@ -373,19 +370,19 @@ static void out(int64_t offset, int32_t segto, const void *data, */ if (src_get(&lineno, &lnfname)) - outfmt->current_dfmt->linenum(lnfname, lineno, segto); + ofmt->current_dfmt->linenum(lnfname, lineno, segto); if (asize && asize > amax) { if (type != OUT_ADDRESS || (int)size < 0) { - errfunc(ERR_NONFATAL, + nasm_error(ERR_NONFATAL, "%d-bit signed relocation unsupported by output format %s\n", - asize << 3, outfmt->shortname); + asize << 3, ofmt->shortname); size = asize; } else { - errfunc(ERR_WARNING | ERR_WARN_ZEXTRELOC, + nasm_error(ERR_WARNING | ERR_WARN_ZEXTRELOC, "%d-bit unsigned relocation zero-extended from %d bits\n", - asize << 3, outfmt->maxbits); - outfmt->output(segto, data, type, amax, segment, wrt); + asize << 3, ofmt->maxbits); + ofmt->output(segto, data, type, amax, segment, wrt); size = asize - amax; } data = zero_buffer; @@ -393,7 +390,7 @@ static void out(int64_t offset, int32_t segto, const void *data, segment = wrt = NO_SEG; } - outfmt->output(segto, data, type, size, segment, wrt); + ofmt->output(segto, data, type, size, segment, wrt); } static void out_imm8(int64_t offset, int32_t segment, @@ -438,7 +435,7 @@ static bool jmp_match(int32_t segment, int64_t offset, int bits, if (is_byte && c == 0371 && ins->prefixes[PPS_REP] == P_BND) { /* jmp short (opcode eb) cannot be used with bnd prefix. */ ins->prefixes[PPS_REP] = P_none; - errfunc(ERR_WARNING | ERR_WARN_BND | ERR_PASS2 , + nasm_error(ERR_WARNING | ERR_WARN_BND | ERR_PASS2 , "jmp short does not init bnd regs - bnd prefix dropped."); } @@ -446,8 +443,7 @@ static bool jmp_match(int32_t segment, int64_t offset, int bits, } int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp, - insn * instruction, struct ofmt *output, efunc error, - ListGen * listgen) + insn * instruction) { const struct itemplate *temp; int j; @@ -457,10 +453,7 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp, int64_t start = offset; int64_t wsize; /* size for DB etc. */ - errfunc = error; /* to pass to other functions */ cpu = cp; - outfmt = output; /* likewise */ - list = listgen; /* and again */ wsize = idata_bytes(instruction->opcode); if (wsize == -1) @@ -470,14 +463,13 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp, extop *e; int32_t t = instruction->times; if (t < 0) - errfunc(ERR_PANIC, - "instruction->times < 0 (%ld) in assemble()", t); + nasm_panic(0, "instruction->times < 0 (%"PRId32") in assemble()", t); while (t--) { /* repeat TIMES times */ list_for_each(e, instruction->eops) { if (e->type == EOT_DB_NUMBER) { if (wsize > 8) { - errfunc(ERR_NONFATAL, + nasm_error(ERR_NONFATAL, "integer supplied to a DT, DO or DY" " instruction"); } else { @@ -503,15 +495,15 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp, } if (t > 0 && t == instruction->times - 1) { /* - * Dummy call to list->output to give the offset to the + * Dummy call to nasmlist->output to give the offset to the * listing module. */ - list->output(offset, NULL, OUT_RAWDATA, 0); - list->uplevel(LIST_TIMES); + nasmlist->output(offset, NULL, OUT_RAWDATA, 0); + nasmlist->uplevel(LIST_TIMES); } } if (instruction->times > 1) - list->downlevel(LIST_TIMES); + nasmlist->downlevel(LIST_TIMES); return offset - start; } @@ -521,10 +513,10 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp, fp = fopen(fname, "rb"); if (!fp) { - error(ERR_NONFATAL, "`incbin': unable to open file `%s'", + nasm_error(ERR_NONFATAL, "`incbin': unable to open file `%s'", fname); } else if (fseek(fp, 0L, SEEK_END) < 0) { - error(ERR_NONFATAL, "`incbin': unable to seek on file `%s'", + nasm_error(ERR_NONFATAL, "`incbin': unable to seek on file `%s'", fname); fclose(fp); } else { @@ -542,11 +534,11 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp, len = (size_t)instruction->eops->next->next->offset; } /* - * Dummy call to list->output to give the offset to the + * Dummy call to nasmlist->output to give the offset to the * listing module. */ - list->output(offset, NULL, OUT_RAWDATA, 0); - list->uplevel(LIST_INCBIN); + nasmlist->output(offset, NULL, OUT_RAWDATA, 0); + nasmlist->uplevel(LIST_INCBIN); while (t--) { size_t l; @@ -561,7 +553,7 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp, * actually changes while we are reading * it. */ - error(ERR_NONFATAL, + nasm_error(ERR_NONFATAL, "`incbin': unexpected EOF while" " reading file `%s'", fname); t = 0; /* Try to exit cleanly */ @@ -572,15 +564,15 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp, l -= m; } } - list->downlevel(LIST_INCBIN); + nasmlist->downlevel(LIST_INCBIN); if (instruction->times > 1) { /* - * Dummy call to list->output to give the offset to the + * Dummy call to nasmlist->output to give the offset to the * listing module. */ - list->output(offset, NULL, OUT_RAWDATA, 0); - list->uplevel(LIST_TIMES); - list->downlevel(LIST_TIMES); + nasmlist->output(offset, NULL, OUT_RAWDATA, 0); + nasmlist->uplevel(LIST_TIMES); + nasmlist->downlevel(LIST_TIMES); } fclose(fp); return instruction->times * len; @@ -598,7 +590,7 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp, int64_t insn_size = calcsize(segment, offset, bits, instruction, temp); itimes = instruction->times; if (insn_size < 0) /* shouldn't be, on pass two */ - error(ERR_PANIC, "errors made it through from pass one"); + nasm_error(ERR_PANIC, "errors made it through from pass one"); else while (itimes--) { for (j = 0; j < MAXPREFIX; j++) { @@ -624,21 +616,21 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp, break; case R_CS: if (bits == 64) { - error(ERR_WARNING | ERR_PASS2, + nasm_error(ERR_WARNING | ERR_PASS2, "cs segment base generated, but will be ignored in 64-bit mode"); } c = 0x2E; break; case R_DS: if (bits == 64) { - error(ERR_WARNING | ERR_PASS2, + nasm_error(ERR_WARNING | ERR_PASS2, "ds segment base generated, but will be ignored in 64-bit mode"); } c = 0x3E; break; case R_ES: if (bits == 64) { - error(ERR_WARNING | ERR_PASS2, + nasm_error(ERR_WARNING | ERR_PASS2, "es segment base generated, but will be ignored in 64-bit mode"); } c = 0x26; @@ -651,19 +643,19 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp, break; case R_SS: if (bits == 64) { - error(ERR_WARNING | ERR_PASS2, + nasm_error(ERR_WARNING | ERR_PASS2, "ss segment base generated, but will be ignored in 64-bit mode"); } c = 0x36; break; case R_SEGR6: case R_SEGR7: - error(ERR_NONFATAL, + nasm_error(ERR_NONFATAL, "segr6 and segr7 cannot be used as prefixes"); break; case P_A16: if (bits == 64) { - error(ERR_NONFATAL, + nasm_error(ERR_NONFATAL, "16-bit addressing is not supported " "in 64-bit mode"); } else if (bits != 16) @@ -675,7 +667,7 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp, break; case P_A64: if (bits != 64) { - error(ERR_NONFATAL, + nasm_error(ERR_NONFATAL, "64-bit addressing is only supported " "in 64-bit mode"); } @@ -704,7 +696,7 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp, case P_none: break; default: - error(ERR_PANIC, "invalid instruction prefix"); + nasm_error(ERR_PANIC, "invalid instruction prefix"); } if (c != 0) { out(offset, segment, &c, OUT_RAWDATA, 1, @@ -718,49 +710,49 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp, offset += insn_size; if (itimes > 0 && itimes == instruction->times - 1) { /* - * Dummy call to list->output to give the offset to the + * Dummy call to nasmlist->output to give the offset to the * listing module. */ - list->output(offset, NULL, OUT_RAWDATA, 0); - list->uplevel(LIST_TIMES); + nasmlist->output(offset, NULL, OUT_RAWDATA, 0); + nasmlist->uplevel(LIST_TIMES); } } if (instruction->times > 1) - list->downlevel(LIST_TIMES); + nasmlist->downlevel(LIST_TIMES); return offset - start; } else { /* No match */ switch (m) { case MERR_OPSIZEMISSING: - error(ERR_NONFATAL, "operation size not specified"); + nasm_error(ERR_NONFATAL, "operation size not specified"); break; case MERR_OPSIZEMISMATCH: - error(ERR_NONFATAL, "mismatch in operand sizes"); + nasm_error(ERR_NONFATAL, "mismatch in operand sizes"); break; case MERR_BRNUMMISMATCH: - error(ERR_NONFATAL, + nasm_error(ERR_NONFATAL, "mismatch in the number of broadcasting elements"); break; case MERR_BADCPU: - error(ERR_NONFATAL, "no instruction for this cpu level"); + nasm_error(ERR_NONFATAL, "no instruction for this cpu level"); break; case MERR_BADMODE: - error(ERR_NONFATAL, "instruction not supported in %d-bit mode", + nasm_error(ERR_NONFATAL, "instruction not supported in %d-bit mode", bits); break; case MERR_ENCMISMATCH: - error(ERR_NONFATAL, "specific encoding scheme not available"); + nasm_error(ERR_NONFATAL, "specific encoding scheme not available"); break; case MERR_BADBND: - error(ERR_NONFATAL, "bnd prefix is not allowed"); + nasm_error(ERR_NONFATAL, "bnd prefix is not allowed"); break; case MERR_BADREPNE: - error(ERR_NONFATAL, "%s prefix is not allowed", + nasm_error(ERR_NONFATAL, "%s prefix is not allowed", (has_prefix(instruction, PPS_REP, P_REPNE) ? "repne" : "repnz")); break; default: - error(ERR_NONFATAL, + nasm_error(ERR_NONFATAL, "invalid combination of opcode and operands"); break; } @@ -769,12 +761,11 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp, } int64_t insn_size(int32_t segment, int64_t offset, int bits, iflag_t cp, - insn * instruction, efunc error) + insn * instruction) { const struct itemplate *temp; enum match_result m; - errfunc = error; /* to pass to other functions */ cpu = cp; if (instruction->opcode == I_none) @@ -817,10 +808,10 @@ int64_t insn_size(int32_t segment, int64_t offset, int bits, iflag_t cp, fp = fopen(fname, "rb"); if (!fp) - error(ERR_NONFATAL, "`incbin': unable to open file `%s'", + nasm_error(ERR_NONFATAL, "`incbin': unable to open file `%s'", fname); else if (fseek(fp, 0L, SEEK_END) < 0) - error(ERR_NONFATAL, "`incbin': unable to seek on file `%s'", + nasm_error(ERR_NONFATAL, "`incbin': unable to seek on file `%s'", fname); else { len = ftell(fp); @@ -912,14 +903,14 @@ static void bad_hle_warn(const insn * ins, uint8_t hleok) case w_lock: if (ins->prefixes[PPS_LOCK] != P_LOCK) { - errfunc(ERR_WARNING | ERR_WARN_HLE | ERR_PASS2, + nasm_error(ERR_WARNING | ERR_WARN_HLE | ERR_PASS2, "%s with this instruction requires lock", prefix_name(rep_pfx)); } break; case w_inval: - errfunc(ERR_WARNING | ERR_WARN_HLE | ERR_PASS2, + nasm_error(ERR_WARNING | ERR_WARN_HLE | ERR_PASS2, "%s invalid with this instruction", prefix_name(rep_pfx)); break; @@ -1117,7 +1108,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits, if (pfx == P_O16) break; if (pfx != P_none) - errfunc(ERR_WARNING | ERR_PASS2, "invalid operand size prefix"); + nasm_error(ERR_WARNING | ERR_PASS2, "invalid operand size prefix"); else ins->prefixes[PPS_OSIZE] = P_O16; break; @@ -1129,7 +1120,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits, if (pfx == P_O32) break; if (pfx != P_none) - errfunc(ERR_WARNING | ERR_PASS2, "invalid operand size prefix"); + nasm_error(ERR_WARNING | ERR_PASS2, "invalid operand size prefix"); else ins->prefixes[PPS_OSIZE] = P_O32; break; @@ -1184,7 +1175,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits, case 0340: if (ins->oprs[0].segment != NO_SEG) - errfunc(ERR_NONFATAL, "attempt to reserve non-constant" + nasm_error(ERR_NONFATAL, "attempt to reserve non-constant" " quantity of BSS space"); else length += ins->oprs[0].offset; @@ -1299,7 +1290,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits, if (process_ea(opy, &ea_data, bits, rfield, rflags, ins) != eat) { - errfunc(ERR_NONFATAL, "invalid effective address"); + nasm_error(ERR_NONFATAL, "invalid effective address"); return -1; } else { ins->rex |= ea_data.rex; @@ -1309,7 +1300,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits, break; default: - errfunc(ERR_PANIC, "internal instruction table corrupt" + nasm_error(ERR_PANIC, "internal instruction table corrupt" ": instruction code \\%o (0x%02X) given", c, c); break; } @@ -1319,7 +1310,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits, if (ins->rex & REX_NH) { if (ins->rex & REX_H) { - errfunc(ERR_NONFATAL, "instruction cannot use high registers"); + nasm_error(ERR_NONFATAL, "instruction cannot use high registers"); return -1; } ins->rex &= ~REX_P; /* Don't force REX prefix due to high reg */ @@ -1343,7 +1334,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits, int bad32 = REX_R|REX_W|REX_X|REX_B; if (ins->rex & REX_H) { - errfunc(ERR_NONFATAL, "cannot use high register in AVX instruction"); + nasm_error(ERR_NONFATAL, "cannot use high register in AVX instruction"); return -1; } switch (ins->vex_wlp & 060) { @@ -1361,11 +1352,11 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits, } if (bits != 64 && ((ins->rex & bad32) || ins->vexreg > 7)) { - errfunc(ERR_NONFATAL, "invalid operands in non-64-bit mode"); + nasm_error(ERR_NONFATAL, "invalid operands in non-64-bit mode"); return -1; } else if (!(ins->rex & REX_EV) && ((ins->vexreg > 15) || (ins->evex_p[0] & 0xf0))) { - errfunc(ERR_NONFATAL, "invalid high-16 register in non-AVX-512"); + nasm_error(ERR_NONFATAL, "invalid high-16 register in non-AVX-512"); return -1; } if (ins->rex & REX_EV) @@ -1377,7 +1368,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits, length += 2; } else if (ins->rex & REX_MASK) { if (ins->rex & REX_H) { - errfunc(ERR_NONFATAL, "cannot use high register in rex instruction"); + nasm_error(ERR_NONFATAL, "cannot use high register in rex instruction"); return -1; } else if (bits == 64) { length++; @@ -1389,14 +1380,14 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits, lockcheck = false; /* Already errored, no need for warning */ length++; } else { - errfunc(ERR_NONFATAL, "invalid operands in non-64-bit mode"); + nasm_error(ERR_NONFATAL, "invalid operands in non-64-bit mode"); return -1; } } if (has_prefix(ins, PPS_LOCK, P_LOCK) && lockcheck && (!itemp_has(temp,IF_LOCK) || !is_class(MEMORY, ins->oprs[0].type))) { - errfunc(ERR_WARNING | ERR_WARN_LOCK | ERR_PASS2 , + nasm_error(ERR_WARNING | ERR_WARN_LOCK | ERR_PASS2 , "instruction is not lockable"); } @@ -1482,7 +1473,7 @@ static void gencode(int32_t segment, int64_t offset, int bits, case4(020): if (opx->offset < -256 || opx->offset > 255) { - errfunc(ERR_WARNING | ERR_PASS2 | ERR_WARN_NOV, + nasm_error(ERR_WARNING | ERR_PASS2 | ERR_WARN_NOV, "byte value exceeds bounds"); } out_imm8(offset, segment, opx, -1); @@ -1491,7 +1482,7 @@ static void gencode(int32_t segment, int64_t offset, int bits, case4(024): if (opx->offset < 0 || opx->offset > 255) - errfunc(ERR_WARNING | ERR_PASS2 | ERR_WARN_NOV, + nasm_error(ERR_WARNING | ERR_PASS2 | ERR_WARN_NOV, "unsigned byte value exceeds bounds"); out_imm8(offset, segment, opx, 1); offset += 1; @@ -1543,7 +1534,7 @@ static void gencode(int32_t segment, int64_t offset, int bits, } else { data = opx->offset - insn_end; if (data > 127 || data < -128) - errfunc(ERR_NONFATAL, "short jump is out of range"); + nasm_error(ERR_NONFATAL, "short jump is out of range"); out(offset, segment, &data, OUT_ADDRESS, 1, NO_SEG, NO_SEG); } @@ -1605,11 +1596,11 @@ static void gencode(int32_t segment, int64_t offset, int bits, case4(074): if (opx->segment == NO_SEG) - errfunc(ERR_NONFATAL, "value referenced by FAR is not" + nasm_error(ERR_NONFATAL, "value referenced by FAR is not" " relocatable"); data = 0; out(offset, segment, &data, OUT_ADDRESS, 2, - outfmt->segbase(1 + opx->segment), + ofmt->segbase(1 + opx->segment), opx->wrt); offset += 2; break; @@ -1620,12 +1611,12 @@ static void gencode(int32_t segment, int64_t offset, int bits, bytes[0] = nasm_regvals[opx->basereg] << 4; opx = &ins->oprs[c & 7]; if (opx->segment != NO_SEG || opx->wrt != NO_SEG) { - errfunc(ERR_NONFATAL, + nasm_error(ERR_NONFATAL, "non-absolute expression not permitted as argument %d", c & 7); } else { if (opx->offset & ~15) { - errfunc(ERR_WARNING | ERR_PASS2 | ERR_WARN_NOV, + nasm_error(ERR_WARNING | ERR_PASS2 | ERR_WARN_NOV, "four-bit argument exceeds bounds"); } bytes[0] |= opx->offset & 15; @@ -1653,7 +1644,7 @@ static void gencode(int32_t segment, int64_t offset, int bits, data = opx->offset; if (opx->wrt == NO_SEG && opx->segment == NO_SEG && (int32_t)data != (int64_t)data) { - errfunc(ERR_WARNING | ERR_PASS2 | ERR_WARN_NOV, + nasm_error(ERR_WARNING | ERR_PASS2 | ERR_WARN_NOV, "signed dword immediate exceeds bounds"); } out(offset, segment, &data, OUT_ADDRESS, -4, @@ -1727,7 +1718,7 @@ static void gencode(int32_t segment, int64_t offset, int bits, /* If this wasn't explicitly byte-sized, warn as though we * had fallen through to the imm16/32/64 case. */ - errfunc(ERR_WARNING | ERR_PASS2 | ERR_WARN_NOV, + nasm_error(ERR_WARNING | ERR_PASS2 | ERR_WARN_NOV, "%s value exceeds bounds", (opx->type & BITS8) ? "signed byte" : s == 16 ? "word" : @@ -1830,7 +1821,7 @@ static void gencode(int32_t segment, int64_t offset, int bits, case 0340: if (ins->oprs[0].segment != NO_SEG) - errfunc(ERR_PANIC, "non-constant BSS size in pass two"); + nasm_error(ERR_PANIC, "non-constant BSS size in pass two"); else { int64_t size = ins->oprs[0].offset; if (size > 0) @@ -1916,7 +1907,7 @@ static void gencode(int32_t segment, int64_t offset, int bits, if (process_ea(opy, &ea_data, bits, rfield, rflags, ins) != eat) - errfunc(ERR_NONFATAL, "invalid effective address"); + nasm_error(ERR_NONFATAL, "invalid effective address"); p = bytes; *p++ = ea_data.modrm; @@ -1975,7 +1966,7 @@ static void gencode(int32_t segment, int64_t offset, int bits, break; default: - errfunc(ERR_PANIC, "internal instruction table corrupt" + nasm_error(ERR_PANIC, "internal instruction table corrupt" ": instruction code \\%o (0x%02X) given", c, c); break; } @@ -1985,14 +1976,14 @@ static void gencode(int32_t segment, int64_t offset, int bits, static opflags_t regflag(const operand * o) { if (!is_register(o->basereg)) - errfunc(ERR_PANIC, "invalid operand passed to regflag()"); + nasm_error(ERR_PANIC, "invalid operand passed to regflag()"); return nasm_reg_flags[o->basereg]; } static int32_t regval(const operand * o) { if (!is_register(o->basereg)) - errfunc(ERR_PANIC, "invalid operand passed to regval()"); + nasm_error(ERR_PANIC, "invalid operand passed to regval()"); return nasm_regvals[o->basereg]; } @@ -2002,7 +1993,7 @@ static int op_rexflags(const operand * o, int mask) int val; if (!is_register(o->basereg)) - errfunc(ERR_PANIC, "invalid operand passed to op_rexflags()"); + nasm_error(ERR_PANIC, "invalid operand passed to op_rexflags()"); flags = nasm_reg_flags[o->basereg]; val = nasm_regvals[o->basereg]; @@ -2159,7 +2150,7 @@ static uint8_t get_broadcast_num(opflags_t opflags, opflags_t brsize) * this cannot be a simple arithmetic calculation. */ if (brsize > BITS64) - errfunc(ERR_FATAL, + nasm_error(ERR_FATAL, "size of broadcasting element is greater than 64 bits"); switch (opsize) { @@ -2966,7 +2957,7 @@ static void add_asp(insn *ins, int addrbits) ins->addr_size = (addrbits == 32) ? 16 : 32; } else { /* Impossible... */ - errfunc(ERR_NONFATAL, "impossible combination of address sizes"); + nasm_error(ERR_NONFATAL, "impossible combination of address sizes"); ins->addr_size = addrbits; /* Error recovery */ } diff --git a/assemble.h b/assemble.h index 381e3ab..f85037a 100644 --- a/assemble.h +++ b/assemble.h @@ -41,8 +41,7 @@ #include "iflag.h" int64_t insn_size(int32_t segment, int64_t offset, int bits, iflag_t cp, - insn * instruction, efunc error); + insn * instruction); int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp, - insn * instruction, struct ofmt *output, efunc error, - ListGen * listgen); + insn * instruction); #endif diff --git a/eval.c b/eval.c index 403a793..a8e463f 100644 --- a/eval.c +++ b/eval.c @@ -54,7 +54,6 @@ #define TEMPEXPR_DELTA 8 static scanner scan; /* Address of scanner routine */ -static efunc error; /* Address of error reporting routine */ static lfunc labelfunc; /* Address of label routine */ static struct ofmt *outfmt; /* Structure of addresses of output routines */ @@ -227,18 +226,18 @@ static expr *segment_part(expr * e) return unknown_expr(); if (!is_reloc(e)) { - error(ERR_NONFATAL, "cannot apply SEG to a non-relocatable value"); + nasm_error(ERR_NONFATAL, "cannot apply SEG to a non-relocatable value"); return NULL; } seg = reloc_seg(e); if (seg == NO_SEG) { - error(ERR_NONFATAL, "cannot apply SEG to a non-relocatable value"); + nasm_error(ERR_NONFATAL, "cannot apply SEG to a non-relocatable value"); return NULL; } else if (seg & SEG_ABS) { return scalarvect(seg & ~SEG_ABS); } else if (seg & 1) { - error(ERR_NONFATAL, "SEG applied to something which" + nasm_error(ERR_NONFATAL, "SEG applied to something which" " is already a segment base"); return NULL; } else { @@ -306,7 +305,7 @@ static expr *rexp0(int critical) return NULL; if (!(is_simple(e) || is_just_unknown(e)) || !(is_simple(f) || is_just_unknown(f))) { - error(ERR_NONFATAL, "`|' operator may only be applied to" + nasm_error(ERR_NONFATAL, "`|' operator may only be applied to" " scalar values"); } @@ -333,7 +332,7 @@ static expr *rexp1(int critical) return NULL; if (!(is_simple(e) || is_just_unknown(e)) || !(is_simple(f) || is_just_unknown(f))) { - error(ERR_NONFATAL, "`^' operator may only be applied to" + nasm_error(ERR_NONFATAL, "`^' operator may only be applied to" " scalar values"); } @@ -359,7 +358,7 @@ static expr *rexp2(int critical) return NULL; if (!(is_simple(e) || is_just_unknown(e)) || !(is_simple(f) || is_just_unknown(f))) { - error(ERR_NONFATAL, "`&' operator may only be applied to" + nasm_error(ERR_NONFATAL, "`&' operator may only be applied to" " scalar values"); } if (is_just_unknown(e) || is_just_unknown(f)) @@ -403,7 +402,7 @@ static expr *rexp3(int critical) if (is_unknown(e)) v = -1; /* means unknown */ else if (!is_really_simple(e)) { - error(ERR_NONFATAL, + nasm_error(ERR_NONFATAL, "`%s': operands differ by a non-scalar", (j == TOKEN_LE ? "<=" : j == TOKEN_LT ? "<" : j == TOKEN_GE ? ">=" : ">")); @@ -443,7 +442,7 @@ static expr *expr0(int critical) return NULL; if (!(is_simple(e) || is_just_unknown(e)) || !(is_simple(f) || is_just_unknown(f))) { - error(ERR_NONFATAL, "`|' operator may only be applied to" + nasm_error(ERR_NONFATAL, "`|' operator may only be applied to" " scalar values"); } if (is_just_unknown(e) || is_just_unknown(f)) @@ -469,7 +468,7 @@ static expr *expr1(int critical) return NULL; if (!(is_simple(e) || is_just_unknown(e)) || !(is_simple(f) || is_just_unknown(f))) { - error(ERR_NONFATAL, "`^' operator may only be applied to" + nasm_error(ERR_NONFATAL, "`^' operator may only be applied to" " scalar values"); } if (is_just_unknown(e) || is_just_unknown(f)) @@ -495,7 +494,7 @@ static expr *expr2(int critical) return NULL; if (!(is_simple(e) || is_just_unknown(e)) || !(is_simple(f) || is_just_unknown(f))) { - error(ERR_NONFATAL, "`&' operator may only be applied to" + nasm_error(ERR_NONFATAL, "`&' operator may only be applied to" " scalar values"); } if (is_just_unknown(e) || is_just_unknown(f)) @@ -522,7 +521,7 @@ static expr *expr3(int critical) return NULL; if (!(is_simple(e) || is_just_unknown(e)) || !(is_simple(f) || is_just_unknown(f))) { - error(ERR_NONFATAL, "shift operator may only be applied to" + nasm_error(ERR_NONFATAL, "shift operator may only be applied to" " scalar values"); } else if (is_just_unknown(e) || is_just_unknown(f)) { e = unknown_expr(); @@ -581,12 +580,12 @@ static expr *expr5(int critical) return NULL; if (j != '*' && (!(is_simple(e) || is_just_unknown(e)) || !(is_simple(f) || is_just_unknown(f)))) { - error(ERR_NONFATAL, "division operator may only be applied to" + nasm_error(ERR_NONFATAL, "division operator may only be applied to" " scalar values"); return NULL; } if (j != '*' && !is_unknown(f) && reloc_value(f) == 0) { - error(ERR_NONFATAL, "division by zero"); + nasm_error(ERR_NONFATAL, "division by zero"); return NULL; } switch (j) { @@ -598,7 +597,7 @@ static expr *expr5(int critical) else if (is_just_unknown(e) && is_just_unknown(f)) e = unknown_expr(); else { - error(ERR_NONFATAL, "unable to multiply two " + nasm_error(ERR_NONFATAL, "unable to multiply two " "non-scalar objects"); return NULL; } @@ -657,7 +656,7 @@ static expr *eval_floatize(enum floatize type) i = scan(scpriv, tokval); if (i != '(') { - error(ERR_NONFATAL, "expecting `('"); + nasm_error(ERR_NONFATAL, "expecting `('"); return NULL; } i = scan(scpriv, tokval); @@ -666,15 +665,14 @@ static expr *eval_floatize(enum floatize type) i = scan(scpriv, tokval); } if (i != TOKEN_FLOAT) { - error(ERR_NONFATAL, "expecting floating-point number"); + nasm_error(ERR_NONFATAL, "expecting floating-point number"); return NULL; } - if (!float_const(tokval->t_charptr, sign, result, - formats[type].bytes, error)) + if (!float_const(tokval->t_charptr, sign, result, formats[type].bytes)) return NULL; i = scan(scpriv, tokval); if (i != ')') { - error(ERR_NONFATAL, "expecting `)'"); + nasm_error(ERR_NONFATAL, "expecting `)'"); return NULL; } @@ -706,13 +704,13 @@ static expr *eval_strfunc(enum strfunc type) i = scan(scpriv, tokval); } if (i != TOKEN_STR) { - error(ERR_NONFATAL, "expecting string"); + nasm_error(ERR_NONFATAL, "expecting string"); return NULL; } string_len = string_transform(tokval->t_charptr, tokval->t_inttwo, &string, type); if (string_len == (size_t)-1) { - error(ERR_NONFATAL, "invalid string for transform"); + nasm_error(ERR_NONFATAL, "invalid string for transform"); return NULL; } @@ -720,13 +718,13 @@ static expr *eval_strfunc(enum strfunc type) if (parens) { i = scan(scpriv, tokval); if (i != ')') { - error(ERR_NONFATAL, "expecting `)'"); + nasm_error(ERR_NONFATAL, "expecting `)'"); return NULL; } } if (rn_warn) - error(ERR_WARNING|ERR_PASS1, "character constant too long"); + nasm_error(ERR_WARNING|ERR_PASS1, "character constant too long"); begintemp(); addtotemp(EXPR_SIMPLE, val); @@ -747,7 +745,7 @@ static int64_t eval_ifunc(int64_t val, enum ifunc func) errtype = (func == IFUNC_ILOG2E) ? ERR_NONFATAL : ERR_WARNING; if (!is_power2(uval)) - error(errtype, "ilog2 argument is not a power of two"); + nasm_error(errtype, "ilog2 argument is not a power of two"); /* fall through */ case IFUNC_ILOG2F: rv = ilog2_64(uval); @@ -758,7 +756,7 @@ static int64_t eval_ifunc(int64_t val, enum ifunc func) break; default: - error(ERR_PANIC, "invalid IFUNC token %d", func); + nasm_error(ERR_PANIC, "invalid IFUNC token %d", func); rv = 0; break; } @@ -796,7 +794,7 @@ static expr *expr6(int critical) if (is_just_unknown(e)) return unknown_expr(); else if (!is_simple(e)) { - error(ERR_NONFATAL, "`~' operator may only be applied to" + nasm_error(ERR_NONFATAL, "`~' operator may only be applied to" " scalar values"); return NULL; } @@ -810,7 +808,7 @@ static expr *expr6(int critical) if (is_just_unknown(e)) return unknown_expr(); else if (!is_simple(e)) { - error(ERR_NONFATAL, "`!' operator may only be applied to" + nasm_error(ERR_NONFATAL, "`!' operator may only be applied to" " scalar values"); return NULL; } @@ -826,7 +824,7 @@ static expr *expr6(int critical) if (is_just_unknown(e)) return unknown_expr(); else if (!is_simple(e)) { - error(ERR_NONFATAL, "function may only be applied to" + nasm_error(ERR_NONFATAL, "function may only be applied to" " scalar values"); return NULL; } @@ -842,7 +840,7 @@ static expr *expr6(int critical) if (!e) return NULL; if (is_unknown(e) && critical) { - error(ERR_NONFATAL, "unable to determine segment base"); + nasm_error(ERR_NONFATAL, "unable to determine segment base"); return NULL; } return e; @@ -859,7 +857,7 @@ static expr *expr6(int critical) if (!e) return NULL; if (i != ')') { - error(ERR_NONFATAL, "expecting `)'"); + nasm_error(ERR_NONFATAL, "expecting `)'"); return NULL; } i = scan(scpriv, tokval); @@ -881,7 +879,7 @@ static expr *expr6(int critical) case TOKEN_STR: tmpval = readstrnum(tokval->t_charptr, tokval->t_inttwo, &rn_warn); if (rn_warn) - error(ERR_WARNING|ERR_PASS1, "character constant too long"); + nasm_error(ERR_WARNING|ERR_PASS1, "character constant too long"); addtotemp(EXPR_SIMPLE, tmpval); break; case TOKEN_REG: @@ -899,7 +897,7 @@ static expr *expr6(int critical) * are in preprocess-only mode. */ if (!location->known) { - error(ERR_NONFATAL, + nasm_error(ERR_NONFATAL, "%s not supported in preprocess-only mode", (i == TOKEN_HERE ? "`$'" : i == TOKEN_BASE ? "`$$'" : @@ -919,11 +917,11 @@ static expr *expr6(int critical) if (!labelfunc(tokval->t_charptr, &label_seg, &label_ofs)) { scope = local_scope(tokval->t_charptr); if (critical == 2) { - error(ERR_NONFATAL, "symbol `%s%s' undefined", + nasm_error(ERR_NONFATAL, "symbol `%s%s' undefined", scope,tokval->t_charptr); return NULL; } else if (critical == 1) { - error(ERR_NONFATAL, + nasm_error(ERR_NONFATAL, "symbol `%s%s' not defined before use", scope,tokval->t_charptr); return NULL; @@ -950,7 +948,7 @@ static expr *expr6(int critical) return finishtemp(); default: - error(ERR_NONFATAL, "expression syntax error"); + nasm_error(ERR_NONFATAL, "expression syntax error"); return NULL; } } @@ -964,8 +962,7 @@ void eval_global_info(struct ofmt *output, lfunc lookup_label, } expr *evaluate(scanner sc, void *scprivate, struct tokenval *tv, - int *fwref, int critical, efunc report_error, - struct eval_hints *hints) + int *fwref, int critical, struct eval_hints *hints) { expr *e; expr *f = NULL; @@ -983,7 +980,6 @@ expr *evaluate(scanner sc, void *scprivate, struct tokenval *tv, scan = sc; scpriv = scprivate; tokval = tv; - error = report_error; opflags = fwref; if (tokval->t_type == TOKEN_INVALID) @@ -1013,14 +1009,14 @@ expr *evaluate(scanner sc, void *scprivate, struct tokenval *tv, int64_t value; begintemp(); if (!is_reloc(f)) { - error(ERR_NONFATAL, "invalid right-hand operand to WRT"); + nasm_error(ERR_NONFATAL, "invalid right-hand operand to WRT"); return NULL; } value = reloc_seg(f); if (value == NO_SEG) value = reloc_value(f) | SEG_ABS; else if (!(value & SEG_ABS) && !(value % 2) && critical) { - error(ERR_NONFATAL, "invalid right-hand operand to WRT"); + nasm_error(ERR_NONFATAL, "invalid right-hand operand to WRT"); return NULL; } addtotemp(EXPR_WRT, value); diff --git a/eval.h b/eval.h index 0ea59d1..76ea14b 100644 --- a/eval.h +++ b/eval.h @@ -50,8 +50,7 @@ void eval_global_info(struct ofmt *output, lfunc lookup_label, * The evaluator itself. */ expr *evaluate(scanner sc, void *scprivate, struct tokenval *tv, - int *fwref, int critical, efunc report_error, - struct eval_hints *hints); + int *fwref, int critical, struct eval_hints *hints); void eval_cleanup(void); diff --git a/float.c b/float.c index 7a4f8cb..adf18c5 100644 --- a/float.c +++ b/float.c @@ -51,7 +51,6 @@ * local variables * ----------------- */ -static efunc error; static bool daz = false; /* denormals as zero */ static enum float_round rc = FLOAT_RC_NEAR; /* rounding control */ @@ -183,7 +182,7 @@ static int32_t read_exponent(const char *string, int32_t max) } else if (*string == '_') { /* do nothing */ } else { - error(ERR_NONFATAL|ERR_PASS1, + nasm_error(ERR_NONFATAL|ERR_PASS1, "invalid character in floating-point constant %s: '%c'", "exponent", *string); return INT32_MAX; @@ -220,7 +219,7 @@ static bool ieee_flconvert(const char *string, fp_limb *mant, if (!seendot) { seendot = true; } else { - error(ERR_NONFATAL|ERR_PASS1, + nasm_error(ERR_NONFATAL|ERR_PASS1, "too many periods in floating-point constant"); return false; } @@ -235,7 +234,7 @@ static bool ieee_flconvert(const char *string, fp_limb *mant, *p++ = *string - '0'; } else { if (!warned) { - error(ERR_WARNING|ERR_WARN_FL_TOOLONG|ERR_PASS1, + nasm_error(ERR_WARNING|ERR_WARN_FL_TOOLONG|ERR_PASS1, "floating-point constant significand contains " "more than %i digits", MANT_DIGITS); warned = true; @@ -248,7 +247,7 @@ static bool ieee_flconvert(const char *string, fp_limb *mant, } else if (*string == '_') { /* do nothing */ } else { - error(ERR_NONFATAL|ERR_PASS1, + nasm_error(ERR_NONFATAL|ERR_PASS1, "invalid character in floating-point constant %s: '%c'", "significand", *string); return false; @@ -534,7 +533,7 @@ static bool ieee_flconvert_bin(const char *string, int bits, if (!seendot) seendot = true; else { - error(ERR_NONFATAL|ERR_PASS1, + nasm_error(ERR_NONFATAL|ERR_PASS1, "too many periods in floating-point constant"); return false; } @@ -576,7 +575,7 @@ static bool ieee_flconvert_bin(const char *string, int bits, } else if (c == '_') { /* ignore */ } else { - error(ERR_NONFATAL|ERR_PASS1, + nasm_error(ERR_NONFATAL|ERR_PASS1, "floating-point constant: `%c' is invalid character", c); return false; } @@ -674,7 +673,7 @@ static int to_packed_bcd(const char *str, const char *p, int tv = -1; if (fmt != &ieee_80) { - error(ERR_NONFATAL|ERR_PASS1, + nasm_error(ERR_NONFATAL|ERR_PASS1, "packed BCD requires an 80-bit format"); return 0; } @@ -684,7 +683,7 @@ static int to_packed_bcd(const char *str, const char *p, if (c >= '0' && c <= '9') { if (tv < 0) { if (n == 9) { - error(ERR_WARNING|ERR_PASS1, + nasm_error(ERR_WARNING|ERR_PASS1, "packed BCD truncated to 18 digits"); } tv = c-'0'; @@ -697,7 +696,7 @@ static int to_packed_bcd(const char *str, const char *p, } else if (c == '_') { /* do nothing */ } else { - error(ERR_NONFATAL|ERR_PASS1, + nasm_error(ERR_NONFATAL|ERR_PASS1, "invalid character `%c' in packed BCD constant", c); return 0; } @@ -734,7 +733,7 @@ static int to_float(const char *str, int s, uint8_t *result, const char *strend; if (!str[0]) { - error(ERR_PANIC, + nasm_error(ERR_PANIC, "internal errror: empty string passed to float_const"); return 0; } @@ -762,7 +761,7 @@ static int to_float(const char *str, int s, uint8_t *result, type = FL_INFINITY; break; default: - error(ERR_NONFATAL|ERR_PASS1, + nasm_error(ERR_NONFATAL|ERR_PASS1, "internal error: unknown FP constant token `%s'\n", str); type = FL_QNAN; break; @@ -810,7 +809,7 @@ static int to_float(const char *str, int s, uint8_t *result, type = FL_NORMAL; } else if (exponent > 0) { if (pass0 == 1) - error(ERR_WARNING|ERR_WARN_FL_OVERFLOW|ERR_PASS1, + nasm_error(ERR_WARNING|ERR_WARN_FL_OVERFLOW|ERR_PASS1, "overflow in floating-point constant"); type = FL_INFINITY; } else { @@ -845,11 +844,11 @@ static int to_float(const char *str, int s, uint8_t *result, } else { if (daz || is_zero(mant)) { /* Flush denormals to zero */ - error(ERR_WARNING|ERR_WARN_FL_UNDERFLOW|ERR_PASS1, + nasm_error(ERR_WARNING|ERR_WARN_FL_UNDERFLOW|ERR_PASS1, "underflow in floating-point constant"); goto zero; } else { - error(ERR_WARNING|ERR_WARN_FL_DENORM|ERR_PASS1, + nasm_error(ERR_WARNING|ERR_WARN_FL_DENORM|ERR_PASS1, "denormal floating-point constant"); } } @@ -865,7 +864,7 @@ static int to_float(const char *str, int s, uint8_t *result, ieee_shr(mant, 1); exponent++; if (exponent >= (expmax << 1)-1) { - error(ERR_WARNING|ERR_WARN_FL_OVERFLOW|ERR_PASS1, + nasm_error(ERR_WARNING|ERR_WARN_FL_OVERFLOW|ERR_PASS1, "overflow in floating-point constant"); type = FL_INFINITY; goto overflow; @@ -901,11 +900,8 @@ static int to_float(const char *str, int s, uint8_t *result, return 1; /* success */ } -int float_const(const char *number, int sign, uint8_t *result, - int bytes, efunc err) +int float_const(const char *number, int sign, uint8_t *result, int bytes) { - error = err; - switch (bytes) { case 1: return to_float(number, sign, result, &ieee_8); @@ -920,7 +916,7 @@ int float_const(const char *number, int sign, uint8_t *result, case 16: return to_float(number, sign, result, &ieee_128); default: - error(ERR_PANIC, "strange value %d passed to float_const", bytes); + nasm_error(ERR_PANIC, "strange value %d passed to float_const", bytes); return 0; } } diff --git a/float.h b/float.h index 6823cd4..b07e542 100644 --- a/float.h +++ b/float.h @@ -48,8 +48,7 @@ enum float_round { FLOAT_RC_UP }; -int float_const(const char *string, int sign, uint8_t *result, int bytes, - efunc error); +int float_const(const char *string, int sign, uint8_t *result, int bytes); int float_option(const char *option); #endif diff --git a/listing.c b/listing.c index 8da58eb..fa85044 100644 --- a/listing.c +++ b/listing.c @@ -126,12 +126,17 @@ static void list_emit(void) } } -static void list_init(char *fname, efunc error) +static void list_init(const char *fname) { + if (!fname) { + listfp = NULL; + return; + } + listfp = fopen(fname, "w"); if (!listfp) { - error(ERR_NONFATAL, "unable to open listing file `%s'", - fname); + nasm_error(ERR_NONFATAL, "unable to open listing file `%s'", + fname); return; } @@ -197,7 +202,7 @@ static void list_output(int32_t offset, const void *data, { char q[20]; - if (!listp || suppress || user_nolist) /* fbk - 9/2/00 */ + if (!listp || suppress || user_nolist) return; switch (type) { @@ -321,7 +326,7 @@ static void list_error(int severity, const char *pfx, const char *msg) } -ListGen nasmlist = { +static const ListGen nasm_list = { list_init, list_cleanup, list_output, @@ -330,3 +335,5 @@ ListGen nasmlist = { list_downlevel, list_error }; + +const ListGen *nasmlist = &nasm_list; diff --git a/listing.h b/listing.h index da2e849..8e178b0 100644 --- a/listing.h +++ b/listing.h @@ -38,7 +38,7 @@ #ifndef NASM_LISTING_H #define NASM_LISTING_H -extern ListGen nasmlist; -extern int user_nolist; /* fbk - 9/1/00 */ +extern const ListGen *nasmlist; +extern bool user_nolist; #endif diff --git a/nasm.c b/nasm.c index ba42aa8..42f1e89 100644 --- a/nasm.c +++ b/nasm.c @@ -78,10 +78,10 @@ static int get_bits(char *value); static iflag_t get_cpu(char *cpu_str); static void parse_cmdline(int, char **); static void assemble_file(char *, StrList **); +static bool is_suppressed_warning(int severity); static void nasm_verror_gnu(int severity, const char *fmt, va_list args); static void nasm_verror_vc(int severity, const char *fmt, va_list args); static void nasm_verror_common(int severity, const char *fmt, va_list args); -static bool is_suppressed_warning(int severity); static void usage(void); static int using_debug_info, opt_verbose_info; @@ -172,7 +172,7 @@ static const struct warning { static bool want_usage; static bool terminate_after_phase; -int user_nolist = 0; /* fbk 9/2/00 */ +bool user_nolist = false; static char *quote_for_make(const char *str); @@ -377,7 +377,7 @@ int main(int argc, char **argv) if (depend_missing_ok) preproc->include_path(NULL); /* "assume generated" */ - preproc->reset(inname, 0, &nasmlist, depend_ptr); + preproc->reset(inname, 0, depend_ptr); if (outname[0] == '\0') ofmt->filename(inname, outname); ofile = NULL; @@ -402,8 +402,9 @@ int main(int argc, char **argv) location.known = false; /* pass = 1; */ - preproc->reset(inname, 3, &nasmlist, depend_ptr); - memcpy(warning_on, warning_on_global, (ERR_WARN_MAX+1) * sizeof(bool)); + preproc->reset(inname, 3, depend_ptr); + memcpy(warning_on, warning_on_global, + (ERR_WARN_MAX+1) * sizeof(bool)); while ((line = preproc->getline())) { /* @@ -1200,8 +1201,7 @@ static void assemble_file(char *fname, StrList **depend_ptr) int pass_max; if (cmd_sb == 32 && iflag_ffs(&cmd_cpu) < IF_386) - nasm_fatal(0, "command line: " - "32-bit segment size requires a higher cpu"); + nasm_fatal(0, "command line: 32-bit segment size requires a higher cpu"); pass_max = prev_offset_changed = (INT_MAX >> 1) + 2; /* Almost unlimited */ for (passn = 1; pass0 <= 2; passn++) { @@ -1217,8 +1217,7 @@ static void assemble_file(char *fname, StrList **depend_ptr) globalbits = sb = cmd_sb; /* set 'bits' to command line default */ cpu = cmd_cpu; if (pass0 == 2) { - if (*listname) - nasmlist.init(listname, nasm_error); + nasmlist->init(listname); } in_abs_seg = false; global_offset_changed = 0; /* set by redefine_label */ @@ -1230,8 +1229,7 @@ static void assemble_file(char *fname, StrList **depend_ptr) raa_free(offsets); offsets = raa_init(); } - preproc->reset(fname, pass1, &nasmlist, - pass1 == 2 ? depend_ptr : NULL); + preproc->reset(fname, pass1, pass1 == 2 ? depend_ptr : NULL); memcpy(warning_on, warning_on_global, (ERR_WARN_MAX+1) * sizeof(bool)); globallineno = 0; @@ -1270,7 +1268,7 @@ static void assemble_file(char *fname, StrList **depend_ptr) stdscan_reset(); stdscan_set(value); tokval.t_type = TOKEN_INVALID; - e = evaluate(stdscan, NULL, &tokval, NULL, pass2, nasm_error, NULL); + e = evaluate(stdscan, NULL, &tokval, NULL, pass2, NULL); if (e) { unsigned int align = (unsigned int)e->value; if ((uint64_t)e->value > 0x7fffffff) { @@ -1428,8 +1426,7 @@ static void assemble_file(char *fname, StrList **depend_ptr) stdscan_reset(); stdscan_set(value); tokval.t_type = TOKEN_INVALID; - e = evaluate(stdscan, NULL, &tokval, NULL, pass2, - nasm_error, NULL); + e = evaluate(stdscan, NULL, &tokval, NULL, pass2, NULL); if (e) { if (!is_reloc(e)) nasm_error(pass0 == @@ -1676,7 +1673,7 @@ static void assemble_file(char *fname, StrList **depend_ptr) if (pass1 == 1) { int64_t l = insn_size(location.segment, offs, sb, cpu, - &output_ins, nasm_error); + &output_ins); /* if (using_debug_info) && output_ins.opcode != -1) */ if (using_debug_info) @@ -1755,8 +1752,7 @@ static void assemble_file(char *fname, StrList **depend_ptr) } else { offs += assemble(location.segment, offs, sb, cpu, - &output_ins, ofmt, nasm_error, - &nasmlist); + &output_ins); set_curr_offs(offs); } @@ -1801,7 +1797,7 @@ static void assemble_file(char *fname, StrList **depend_ptr) } preproc->cleanup(0); - nasmlist.cleanup(); + nasmlist->cleanup(); if (!terminate_after_phase && opt_verbose_info) { /* -On and -Ov switches */ fprintf(stdout, "info: assembly required 1+%d+1 passes\n", passn-3); @@ -1985,8 +1981,7 @@ static void nasm_verror_common(int severity, const char *fmt, va_list args) fprintf(error_file, "%s%s\n", pfx, msg); - if (*listname) - nasmlist.error(severity, pfx, msg); + nasmlist->error(severity, pfx, msg); if (severity & ERR_USAGE) want_usage = true; diff --git a/nasm.h b/nasm.h index 48284f6..ff2acfe 100644 --- a/nasm.h +++ b/nasm.h @@ -136,7 +136,7 @@ typedef struct { * called. The `char *' parameter is the file name to write the * listing to. */ - void (*init)(char *fname, efunc error); + void (*init)(const char *fname); /* * Called to clear stuff up and close the listing file. @@ -190,6 +190,8 @@ typedef struct { void (*error)(int severity, const char *pfx, const char *msg); } ListGen; +extern const ListGen *nasmlist; + /* * Token types returned by the scanner, in addition to ordinary * ASCII character values, and zero for end-of-string. @@ -351,7 +353,7 @@ struct eval_hints { #define CRITICAL 0x100 typedef expr *(*evalfunc)(scanner sc, void *scprivate, struct tokenval *tv, int *fwref, int critical, - efunc error, struct eval_hints *hints); + struct eval_hints *hints); /* * Special values for expr->type. @@ -382,7 +384,7 @@ struct preproc_ops { ... [truncated message content] |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-03-03 23:27:22
|
Commit-ID: bd464749d1aa2e7b375ba430b2e755a52edbbef0 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=bd464749d1aa2e7b375ba430b2e755a52edbbef0 Author: H. Peter Anvin <hp...@li...> AuthorDate: Wed, 17 Feb 2016 20:47:01 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Thu, 3 Mar 2016 15:22:03 -0800 Output preprocessor warnings to the listing file Most preprocessor warnings are ERR_PASS1, but we want to see them in the listing file too. If we make it to the code-generation pass, ignore ERR_PASS* for the purpose of emitting warnings to the list file. While we are at it, allow ERR_DEBUG to specify ERR_PASS* too. >From master branch checkin 4a8d10c1a004ace853dd3019814329065dda5050 Signed-off-by: H. Peter Anvin <hp...@li...> --- nasm.c | 58 +++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/nasm.c b/nasm.c index 42f1e89..0520500 100644 --- a/nasm.c +++ b/nasm.c @@ -79,6 +79,7 @@ static iflag_t get_cpu(char *cpu_str); static void parse_cmdline(int, char **); static void assemble_file(char *, StrList **); static bool is_suppressed_warning(int severity); +static bool skip_this_pass(int severity); static void nasm_verror_gnu(int severity, const char *fmt, va_list args); static void nasm_verror_vc(int severity, const char *fmt, va_list args); static void nasm_verror_common(int severity, const char *fmt, va_list args); @@ -1869,11 +1870,13 @@ static void nasm_verror_gnu(int severity, const char *fmt, va_list ap) if (!(severity & ERR_NOFILE)) src_get(&lineno, ¤tfile); - if (currentfile) { - fprintf(error_file, "%s:%"PRId32": ", currentfile, lineno); - nasm_free(currentfile); - } else { - fputs("nasm: ", error_file); + if (!skip_this_pass(severity)) { + if (currentfile) { + fprintf(error_file, "%s:%"PRId32": ", currentfile, lineno); + nasm_free(currentfile); + } else { + fputs("nasm: ", error_file); + } } nasm_verror_common(severity, fmt, ap); @@ -1905,11 +1908,13 @@ static void nasm_verror_vc(int severity, const char *fmt, va_list ap) if (!(severity & ERR_NOFILE)) src_get(&lineno, ¤tfile); - if (currentfile) { - fprintf(error_file, "%s(%"PRId32") : ", currentfile, lineno); - nasm_free(currentfile); - } else { - fputs("nasm: ", error_file); + if (!skip_this_pass(severity)) { + if (currentfile) { + fprintf(error_file, "%s(%"PRId32") : ", currentfile, lineno); + nasm_free(currentfile); + } else { + fputs("nasm: ", error_file); + } } nasm_verror_common(severity, fmt, ap); @@ -1929,11 +1934,6 @@ static bool is_suppressed_warning(int severity) if ((severity & ERR_MASK) != ERR_WARNING) return false; - /* See if it's a pass-one only warning and we're not in pass one. */ - if (((severity & ERR_PASS1) && pass0 != 1) || - ((severity & ERR_PASS2) && pass0 != 2)) - return true; - /* Might be a warning but suppresed explicitly */ if (severity & ERR_WARN_MASK) return !warning_on[WARN_IDX(severity)]; @@ -1941,6 +1941,19 @@ static bool is_suppressed_warning(int severity) return false; } +static bool skip_this_pass(int severity) +{ + /* See if it's a pass-one only warning and we're not in pass one. */ + if ((severity & ERR_MASK) > ERR_WARNING) + return false; + + if (((severity & ERR_PASS1) && pass0 != 1) || + ((severity & ERR_PASS2) && pass0 != 2)) + return true; + + return false; +} + /** * common error reporting * This is the common back end of the error reporting schemes currently @@ -1979,9 +1992,15 @@ static void nasm_verror_common(int severity, const char *fmt, va_list args) vsnprintf(msg, sizeof msg, fmt, args); - fprintf(error_file, "%s%s\n", pfx, msg); + if (!skip_this_pass(severity)) + fprintf(error_file, "%s%s\n", pfx, msg); - nasmlist->error(severity, pfx, msg); + /* + * Don't suppress this with skip_this_pass(), or we don't get + * preprocessor warnings in the list file + */ + if ((severity & ERR_MASK) >= ERR_WARNING) + nasmlist->error(severity, pfx, msg); if (severity & ERR_USAGE) want_usage = true; @@ -2011,6 +2030,11 @@ static void nasm_verror_common(int severity, const char *fmt, va_list args) case ERR_PANIC: fflush(NULL); /* abort(); */ /* halt, catch fire, and dump core */ + if (ofile) { + fclose(ofile); + remove(outname); + ofile = NULL; + } exit(3); break; } |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-03-03 23:27:21
|
Commit-ID: 41087068aa3d5ddac8b28cb2bdcacd606f475c08 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=41087068aa3d5ddac8b28cb2bdcacd606f475c08 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Thu, 3 Mar 2016 14:27:34 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Thu, 3 Mar 2016 15:22:02 -0800 Replace nasm_error(ERR_FATAL/ERR_PANIC) with nasm_fatal/nasm_panic Replace all instances of ERR_FATAL or ERR_PANIC with nasm_fatal or nasm_panic so the compiler knows that these functions cannot return, *and* we trigger abort() if we were to ever violate that constraint. Signed-off-by: H. Peter Anvin <hp...@zy...> --- labels.c | 2 +- lib/vsnprintf.c | 4 ++-- nasm.c | 26 +++++++++++++------------- nasmlib.c | 4 ++-- output/outaout.c | 6 +++--- output/outas86.c | 8 ++++---- output/outbin.c | 20 ++++++++++---------- output/outcoff.c | 8 ++++---- output/outelf32.c | 8 ++++---- output/outelf64.c | 16 ++++++++-------- output/outelfx32.c | 14 +++++++------- output/outieee.c | 18 +++++++++--------- output/outmacho.c | 2 +- output/outobj.c | 18 +++++++++--------- output/outrdf2.c | 18 +++++++++--------- parser.c | 2 +- preproc-nop.c | 2 +- preproc.c | 2 +- 18 files changed, 89 insertions(+), 89 deletions(-) diff --git a/labels.c b/labels.c index e14fe47..9f2b76e 100644 --- a/labels.c +++ b/labels.c @@ -234,7 +234,7 @@ void redefine_label(char *label, int32_t segment, int64_t offset, char *special, lptr = find_label(label, 1); if (!lptr) - nasm_error(ERR_PANIC, "can't find label `%s' on pass two", label); + nasm_panic(0, "can't find label `%s' on pass two", label); if (!islocal(label)) { if (!islocalchar(*label) && lptr->defn.is_norm) diff --git a/lib/vsnprintf.c b/lib/vsnprintf.c index bc54f94..ecca3e6 100644 --- a/lib/vsnprintf.c +++ b/lib/vsnprintf.c @@ -23,7 +23,7 @@ int vsnprintf(char *str, size_t size, const char *format, va_list ap) int rv, bytes; if (size > BUFFER_SIZE) { - nasm_error(ERR_PANIC|ERR_NOFILE, + nasm_panic(ERR_NOFILE, "vsnprintf: size (%d) > BUFFER_SIZE (%d)", size, BUFFER_SIZE); size = BUFFER_SIZE; @@ -31,7 +31,7 @@ int vsnprintf(char *str, size_t size, const char *format, va_list ap) rv = vsprintf(snprintf_buffer, format, ap); if (rv >= BUFFER_SIZE) - nasm_error(ERR_PANIC|ERR_NOFILE, "vsnprintf buffer overflow"); + nasm_panic(ERR_NOFILE, "vsnprintf buffer overflow"); if (size > 0) { if ((size_t)rv < size-1) diff --git a/nasm.c b/nasm.c index 5556e06..ba42aa8 100644 --- a/nasm.c +++ b/nasm.c @@ -393,7 +393,7 @@ int main(int argc, char **argv) if (*outname) { ofile = fopen(outname, "w"); if (!ofile) - nasm_error(ERR_FATAL | ERR_NOFILE, + nasm_fatal(ERR_NOFILE, "unable to open output file `%s'", outname); } else @@ -446,7 +446,7 @@ int main(int argc, char **argv) ofile = fopen(outname, (ofmt->flags & OFMT_TEXT) ? "w" : "wb"); if (!ofile) - nasm_error(ERR_FATAL | ERR_NOFILE, + nasm_fatal(ERR_NOFILE, "unable to open output file `%s'", outname); /* @@ -519,7 +519,7 @@ static void copy_filename(char *dst, const char *src) size_t len = strlen(src); if (len >= (size_t)FILENAME_MAX) { - nasm_error(ERR_FATAL | ERR_NOFILE, "file name too long"); + nasm_fatal(ERR_NOFILE, "file name too long"); return; } strncpy(dst, src, FILENAME_MAX); @@ -659,7 +659,7 @@ static bool process_arg(char *p, char *q) case 'f': /* output format */ ofmt = ofmt_find(param, &ofmt_alias); if (!ofmt) { - nasm_error(ERR_FATAL | ERR_NOFILE | ERR_USAGE, + nasm_fatal(ERR_NOFILE | ERR_USAGE, "unrecognised output format `%s' - " "use -hf for a list", param); } @@ -699,7 +699,7 @@ static bool process_arg(char *p, char *q) break; default: - nasm_error(ERR_FATAL, + nasm_fatal(0, "unknown optimization option -O%c\n", *param); break; @@ -742,7 +742,7 @@ static bool process_arg(char *p, char *q) case 'F': /* specify debug format */ ofmt->current_dfmt = dfmt_find(ofmt, param); if (!ofmt->current_dfmt) { - nasm_error(ERR_FATAL | ERR_NOFILE | ERR_USAGE, + nasm_fatal(ERR_NOFILE | ERR_USAGE, "unrecognized debug format `%s' for" " output format `%s'", param, ofmt->shortname); @@ -756,7 +756,7 @@ static bool process_arg(char *p, char *q) else if (nasm_stricmp("gnu", param) == 0) nasm_set_verror(nasm_verror_gnu); else - nasm_error(ERR_FATAL | ERR_NOFILE | ERR_USAGE, + nasm_fatal(ERR_NOFILE | ERR_USAGE, "unrecognized error reporting format `%s'", param); break; @@ -967,7 +967,7 @@ set_warning: strlcpy(lpostfix, param, POSTFIX_MAX); break; default: - nasm_error(ERR_PANIC | ERR_NOFILE, + nasm_panic(ERR_NOFILE, "internal error"); break; } @@ -1170,7 +1170,7 @@ static void parse_cmdline(int argc, char **argv) !strcmp(inname, outname) || !strcmp(inname, listname) || (depend_file && !strcmp(inname, depend_file))) - nasm_error(ERR_FATAL | ERR_NOFILE | ERR_USAGE, + nasm_fatal(ERR_NOFILE | ERR_USAGE, "file `%s' is both input and output file", inname); @@ -1178,7 +1178,7 @@ static void parse_cmdline(int argc, char **argv) error_file = fopen(errname, "w"); if (!error_file) { error_file = stderr; /* Revert to default! */ - nasm_error(ERR_FATAL | ERR_NOFILE | ERR_USAGE, + nasm_fatal(ERR_NOFILE | ERR_USAGE, "cannot open file `%s' for error messages", errname); } @@ -1200,7 +1200,7 @@ static void assemble_file(char *fname, StrList **depend_ptr) int pass_max; if (cmd_sb == 32 && iflag_ffs(&cmd_cpu) < IF_386) - nasm_error(ERR_FATAL, "command line: " + nasm_fatal(0, "command line: " "32-bit segment size requires a higher cpu"); pass_max = prev_offset_changed = (INT_MAX >> 1) + 2; /* Almost unlimited */ @@ -1279,7 +1279,7 @@ static void assemble_file(char *fname, StrList **depend_ptr) * ofmt should have some 'check' method which * would report segment alignment bounds. */ - nasm_error(ERR_FATAL, + nasm_fatal(0, "incorrect segment alignment `%s'", value); } else if (!is_power2(align)) { nasm_error(ERR_NONFATAL, @@ -1443,7 +1443,7 @@ static void assemble_file(char *fname, StrList **depend_ptr) } else if (passn == 1) abs_offset = 0x100; /* don't go near zero in case of / */ else - nasm_error(ERR_PANIC, "invalid ABSOLUTE address " + nasm_panic(0, "invalid ABSOLUTE address " "in pass two"); in_abs_seg = true; location.segment = NO_SEG; diff --git a/nasmlib.c b/nasmlib.c index d19cbf6..265091c 100644 --- a/nasmlib.c +++ b/nasmlib.c @@ -163,7 +163,7 @@ char *nasm_strndup(const char *s, size_t len) no_return nasm_assert_failed(const char *file, int line, const char *msg) { - nasm_error(ERR_FATAL, "assertion %s failed at %s:%d", msg, file, line); + nasm_fatal(0, "assertion %s failed at %s:%d", msg, file, line); exit(1); } @@ -171,7 +171,7 @@ void nasm_write(const void *ptr, size_t size, FILE *f) { size_t n = fwrite(ptr, 1, size, f); if (n != size) - nasm_error(ERR_FATAL, "unable to write output: %s", strerror(errno)); + nasm_fatal(0, "unable to write output: %s", strerror(errno)); } #ifndef nasm_stricmp diff --git a/output/outaout.c b/output/outaout.c index 360f549..fe49feb 100644 --- a/output/outaout.c +++ b/output/outaout.c @@ -631,7 +631,7 @@ static void aout_out(int32_t segto, const void *data, sbss.len += size; } else if (type == OUT_RAWDATA) { if (segment != NO_SEG) - nasm_error(ERR_PANIC, "OUT_RAWDATA with other than NO_SEG"); + nasm_panic(0, "OUT_RAWDATA with other than NO_SEG"); aout_sect_write(s, data, size); } else if (type == OUT_ADDRESS) { int asize = abs((int)size); @@ -683,7 +683,7 @@ static void aout_out(int32_t segto, const void *data, aout_sect_write(s, mydata, asize); } else if (type == OUT_REL2ADR) { if (segment == segto) - nasm_error(ERR_PANIC, "intra-segment OUT_REL2ADR"); + nasm_panic(0, "intra-segment OUT_REL2ADR"); if (segment != NO_SEG && segment % 2) { nasm_error(ERR_NONFATAL, "a.out format does not support" " segment base references"); @@ -713,7 +713,7 @@ static void aout_out(int32_t segto, const void *data, aout_sect_write(s, mydata, 2L); } else if (type == OUT_REL4ADR) { if (segment == segto) - nasm_error(ERR_PANIC, "intra-segment OUT_REL4ADR"); + nasm_panic(0, "intra-segment OUT_REL4ADR"); if (segment != NO_SEG && segment % 2) { nasm_error(ERR_NONFATAL, "a.out format does not support" " segment base references"); diff --git a/output/outas86.c b/output/outas86.c index 43108c4..84e3035 100644 --- a/output/outas86.c +++ b/output/outas86.c @@ -343,7 +343,7 @@ static void as86_out(int32_t segto, const void *data, bsslen += size; } else if (type == OUT_RAWDATA) { if (segment != NO_SEG) - nasm_error(ERR_PANIC, "OUT_RAWDATA with other than NO_SEG"); + nasm_panic(0, "OUT_RAWDATA with other than NO_SEG"); as86_sect_write(s, data, size); as86_add_piece(s, 0, 0L, 0L, size, 0); } else if (type == OUT_ADDRESS) { @@ -364,7 +364,7 @@ static void as86_out(int32_t segto, const void *data, } } else if (type == OUT_REL2ADR) { if (segment == segto) - nasm_error(ERR_PANIC, "intra-segment OUT_REL2ADR"); + nasm_panic(0, "intra-segment OUT_REL2ADR"); if (segment != NO_SEG) { if (segment % 2) { nasm_error(ERR_NONFATAL, "as86 format does not support" @@ -377,7 +377,7 @@ static void as86_out(int32_t segto, const void *data, } } else if (type == OUT_REL4ADR) { if (segment == segto) - nasm_error(ERR_PANIC, "intra-segment OUT_REL4ADR"); + nasm_panic(0, "intra-segment OUT_REL4ADR"); if (segment != NO_SEG) { if (segment % 2) { nasm_error(ERR_NONFATAL, "as86 format does not support" @@ -518,7 +518,7 @@ static void as86_set_rsize(int size) fputc(0x03, ofile); break; default: - nasm_error(ERR_PANIC, "bizarre relocation size %d", size); + nasm_panic(0, "bizarre relocation size %d", size); break; } } diff --git a/output/outbin.c b/output/outbin.c index 71c7bcd..47fbb47 100644 --- a/output/outbin.c +++ b/output/outbin.c @@ -270,7 +270,7 @@ static void bin_cleanup(int debuginfo) if (s->flags & (START_DEFINED | ALIGN_DEFINED | FOLLOWS_DEFINED)) { /* Check for a mixture of real and virtual section attributes. */ if (s->flags & (VSTART_DEFINED | VALIGN_DEFINED | VFOLLOWS_DEFINED)) - nasm_error(ERR_FATAL|ERR_NOFILE, + nasm_fatal(ERR_NOFILE, "cannot mix real and virtual attributes" " in nobits section (%s)", s->name); /* Real and virtual attributes mean the same thing for nobits sections. */ @@ -341,11 +341,11 @@ static void bin_cleanup(int debuginfo) s && strcmp(s->name, g->follows); sp = &s->next, s = s->next) ; if (!s) - nasm_error(ERR_FATAL|ERR_NOFILE, "section %s follows an invalid or" + nasm_fatal(ERR_NOFILE, "section %s follows an invalid or" " unknown section (%s)", g->name, g->follows); if (s->next && (s->next->flags & FOLLOWS_DEFINED) && !strcmp(s->name, s->next->follows)) - nasm_error(ERR_FATAL|ERR_NOFILE, "sections %s and %s can't both follow" + nasm_fatal(ERR_NOFILE, "sections %s and %s can't both follow" " section %s", g->name, s->next->name, s->name); /* Find the end of the current follows group (gs). */ for (gsp = &g->next, gs = g->next; @@ -389,7 +389,7 @@ static void bin_cleanup(int debuginfo) if (sections->flags & START_DEFINED) { /* Make sure this section doesn't begin before the origin. */ if (sections->start < origin) - nasm_error(ERR_FATAL|ERR_NOFILE, "section %s begins" + nasm_fatal(ERR_NOFILE, "section %s begins" " before program origin", sections->name); } else if (sections->flags & ALIGN_DEFINED) { sections->start = ALIGN(origin, sections->align); @@ -445,13 +445,13 @@ static void bin_cleanup(int debuginfo) /* Check for section overlap. */ if (s) { if (s->start < origin) - nasm_error(ERR_FATAL|ERR_NOFILE, "section %s beings before program origin", + nasm_fatal(ERR_NOFILE, "section %s beings before program origin", s->name); if (g->start > s->start) - nasm_error(ERR_FATAL|ERR_NOFILE, "sections %s ~ %s and %s overlap!", + nasm_fatal(ERR_NOFILE, "sections %s ~ %s and %s overlap!", gs->name, g->name, s->name); if (pend > s->start) - nasm_error(ERR_FATAL|ERR_NOFILE, "sections %s and %s overlap!", + nasm_fatal(ERR_NOFILE, "sections %s and %s overlap!", g->name, s->name); } /* Remember this section as the latest >0 length section. */ @@ -480,7 +480,7 @@ static void bin_cleanup(int debuginfo) for (s = sections; s && strcmp(g->vfollows, s->name); s = s->next) ; if (!s) - nasm_error(ERR_FATAL|ERR_NOFILE, + nasm_fatal(ERR_NOFILE, "section %s vfollows unknown section (%s)", g->name, g->vfollows); } else if (g->prev != NULL) @@ -519,7 +519,7 @@ static void bin_cleanup(int debuginfo) } } if (h) - nasm_error(ERR_FATAL|ERR_NOFILE, "circular vfollows path detected"); + nasm_fatal(ERR_NOFILE, "circular vfollows path detected"); #ifdef DEBUG nasm_error(ERR_DEBUG, @@ -748,7 +748,7 @@ static void bin_out(int32_t segto, const void *data, /* Find the segment we are targeting. */ s = find_section_by_index(segto); if (!s) - nasm_error(ERR_PANIC, "code directed to nonexistent segment?"); + nasm_panic(0, "code directed to nonexistent segment?"); /* "Smart" section-type adaptation code. */ if (!(s->flags & TYPE_DEFINED)) { diff --git a/output/outcoff.c b/output/outcoff.c index a712f95..9587f35 100644 --- a/output/outcoff.c +++ b/output/outcoff.c @@ -583,7 +583,7 @@ static void coff_out(int32_t segto, const void *data, if (!s) { int tempint; /* ignored */ if (segto != coff_section_names(".text", 2, &tempint)) - nasm_error(ERR_PANIC, "strange segment conditions in COFF driver"); + nasm_panic(0, "strange segment conditions in COFF driver"); else s = coff_sects[coff_nsects - 1]; } @@ -626,7 +626,7 @@ static void coff_out(int32_t segto, const void *data, s->len += size; } else if (type == OUT_RAWDATA) { if (segment != NO_SEG) - nasm_error(ERR_PANIC, "OUT_RAWDATA with other than NO_SEG"); + nasm_panic(0, "OUT_RAWDATA with other than NO_SEG"); coff_sect_write(s, data, size); } else if (type == OUT_ADDRESS) { int asize = abs((int)size); @@ -674,7 +674,7 @@ static void coff_out(int32_t segto, const void *data, " relocations"); } else if (type == OUT_REL4ADR) { if (segment == segto && !(win64)) /* Acceptable for RIP-relative */ - nasm_error(ERR_PANIC, "intra-segment OUT_REL4ADR"); + nasm_panic(0, "intra-segment OUT_REL4ADR"); else if (segment == NO_SEG && win32) nasm_error(ERR_NONFATAL, "Win32 COFF does not correctly support" " relative references to absolute addresses"); @@ -875,7 +875,7 @@ static inline void coff_adjust_relocs(struct coff_Section *s) else { if (ofmt == &of_coff) - nasm_error(ERR_FATAL, + nasm_fatal(0, "Too many relocations (%d) for section `%s'", s->nrelocs, s->name); } diff --git a/output/outelf32.c b/output/outelf32.c index a8b181a..9c83a57 100644 --- a/output/outelf32.c +++ b/output/outelf32.c @@ -422,7 +422,7 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset, /* we have to be sure at least text section is there */ int tempint; if (segment != elf_section_names(".text", 2, &tempint)) - nasm_error(ERR_PANIC, "strange segment conditions in ELF driver"); + nasm_panic(0, "strange segment conditions in ELF driver"); } for (i = 0; i < nsects; i++) { if (segment == sects[i]->index) { @@ -686,7 +686,7 @@ static void elf_out(int32_t segto, const void *data, if (!s) { int tempint; /* ignored */ if (segto != elf_section_names(".text", 2, &tempint)) - nasm_error(ERR_PANIC, "strange segment conditions in ELF driver"); + nasm_panic(0, "strange segment conditions in ELF driver"); else { s = sects[nsects - 1]; i = nsects - 1; @@ -723,7 +723,7 @@ static void elf_out(int32_t segto, const void *data, case OUT_RAWDATA: if (segment != NO_SEG) - nasm_error(ERR_PANIC, "OUT_RAWDATA with other than NO_SEG"); + nasm_panic(0, "OUT_RAWDATA with other than NO_SEG"); elf_sect_write(s, data, size); break; @@ -846,7 +846,7 @@ static void elf_out(int32_t segto, const void *data, case OUT_REL4ADR: if (segment == segto) - nasm_error(ERR_PANIC, "intra-segment OUT_REL4ADR"); + nasm_panic(0, "intra-segment OUT_REL4ADR"); if (segment != NO_SEG && segment % 2) { nasm_error(ERR_NONFATAL, "ELF format does not support" " segment base references"); diff --git a/output/outelf64.c b/output/outelf64.c index f2a192a..ef0b937 100644 --- a/output/outelf64.c +++ b/output/outelf64.c @@ -427,7 +427,7 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset, /* we have to be sure at least text section is there */ int tempint; if (segment != elf_section_names(".text", 2, &tempint)) - nasm_error(ERR_PANIC, "strange segment conditions in ELF driver"); + nasm_panic(0, "strange segment conditions in ELF driver"); } for (i = 0; i < nsects; i++) { if (segment == sects[i]->index) { @@ -702,7 +702,7 @@ static void elf_out(int32_t segto, const void *data, if (!s) { int tempint; /* ignored */ if (segto != elf_section_names(".text", 2, &tempint)) - nasm_error(ERR_PANIC, "strange segment conditions in ELF driver"); + nasm_panic(0, "strange segment conditions in ELF driver"); else { s = sects[nsects - 1]; i = nsects - 1; @@ -738,7 +738,7 @@ static void elf_out(int32_t segto, const void *data, case OUT_RAWDATA: if (segment != NO_SEG) - nasm_error(ERR_PANIC, "OUT_RAWDATA with other than NO_SEG"); + nasm_panic(0, "OUT_RAWDATA with other than NO_SEG"); elf_sect_write(s, data, size); break; @@ -775,7 +775,7 @@ static void elf_out(int32_t segto, const void *data, elf_add_reloc(s, segment, addr, R_X86_64_64); break; default: - nasm_error(ERR_PANIC, "internal error elf64-hpa-871"); + nasm_panic(0, "internal error elf64-hpa-871"); break; } addr = 0; @@ -843,7 +843,7 @@ static void elf_out(int32_t segto, const void *data, addr = 0; break; default: - nasm_error(ERR_PANIC, "internal error elf64-hpa-903"); + nasm_panic(0, "internal error elf64-hpa-903"); break; } } else if (wrt == elf_plt_sect + 1) { @@ -871,7 +871,7 @@ static void elf_out(int32_t segto, const void *data, rel12adr: addr = *(int64_t *)data - size; if (segment == segto) - nasm_error(ERR_PANIC, "intra-segment OUT_REL1ADR"); + nasm_panic(0, "intra-segment OUT_REL1ADR"); if (segment == NO_SEG) { /* Do nothing */ } else if (segment % 2) { @@ -892,7 +892,7 @@ static void elf_out(int32_t segto, const void *data, case OUT_REL4ADR: addr = *(int64_t *)data - size; if (segment == segto) - nasm_error(ERR_PANIC, "intra-segment OUT_REL4ADR"); + nasm_panic(0, "intra-segment OUT_REL4ADR"); if (segment == NO_SEG) { /* Do nothing */ } else if (segment % 2) { @@ -930,7 +930,7 @@ static void elf_out(int32_t segto, const void *data, case OUT_REL8ADR: addr = *(int64_t *)data - size; if (segment == segto) - nasm_error(ERR_PANIC, "intra-segment OUT_REL8ADR"); + nasm_panic(0, "intra-segment OUT_REL8ADR"); if (segment == NO_SEG) { /* Do nothing */ } else if (segment % 2) { diff --git a/output/outelfx32.c b/output/outelfx32.c index c217c7b..18f3724 100644 --- a/output/outelfx32.c +++ b/output/outelfx32.c @@ -426,7 +426,7 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset, /* we have to be sure at least text section is there */ int tempint; if (segment != elf_section_names(".text", 2, &tempint)) - nasm_error(ERR_PANIC, "strange segment conditions in ELF driver"); + nasm_panic(0, "strange segment conditions in ELF driver"); } for (i = 0; i < nsects; i++) { if (segment == sects[i]->index) { @@ -701,7 +701,7 @@ static void elf_out(int32_t segto, const void *data, if (!s) { int tempint; /* ignored */ if (segto != elf_section_names(".text", 2, &tempint)) - nasm_error(ERR_PANIC, "strange segment conditions in ELF driver"); + nasm_panic(0, "strange segment conditions in ELF driver"); else { s = sects[nsects - 1]; i = nsects - 1; @@ -737,7 +737,7 @@ static void elf_out(int32_t segto, const void *data, case OUT_RAWDATA: if (segment != NO_SEG) - nasm_error(ERR_PANIC, "OUT_RAWDATA with other than NO_SEG"); + nasm_panic(0, "OUT_RAWDATA with other than NO_SEG"); elf_sect_write(s, data, size); break; @@ -774,7 +774,7 @@ static void elf_out(int32_t segto, const void *data, elf_add_reloc(s, segment, addr, R_X86_64_64); break; default: - nasm_error(ERR_PANIC, "internal error elfx32-hpa-871"); + nasm_panic(0, "internal error elfx32-hpa-871"); break; } addr = 0; @@ -832,7 +832,7 @@ static void elf_out(int32_t segto, const void *data, addr = 0; break; default: - nasm_error(ERR_PANIC, "internal error elfx32-hpa-903"); + nasm_panic(0, "internal error elfx32-hpa-903"); break; } } else if (wrt == elf_plt_sect + 1) { @@ -860,7 +860,7 @@ static void elf_out(int32_t segto, const void *data, rel12adr: addr = *(int64_t *)data - size; if (segment == segto) - nasm_error(ERR_PANIC, "intra-segment OUT_REL1ADR"); + nasm_panic(0, "intra-segment OUT_REL1ADR"); if (segment == NO_SEG) { /* Do nothing */ } else if (segment % 2) { @@ -881,7 +881,7 @@ static void elf_out(int32_t segto, const void *data, case OUT_REL4ADR: addr = *(int64_t *)data - size; if (segment == segto) - nasm_error(ERR_PANIC, "intra-segment OUT_REL4ADR"); + nasm_panic(0, "intra-segment OUT_REL4ADR"); if (segment == NO_SEG) { /* Do nothing */ } else if (segment % 2) { diff --git a/output/outieee.c b/output/outieee.c index 42f0fb6..2415bc7 100644 --- a/output/outieee.c +++ b/output/outieee.c @@ -419,7 +419,7 @@ static void ieee_out(int32_t segto, const void *data, if (!any_segs) { int tempint; /* ignored */ if (segto != ieee_segment("__NASMDEFSEG", 2, &tempint)) - nasm_error(ERR_PANIC, "strange segment conditions in IEEE driver"); + nasm_panic(0, "strange segment conditions in IEEE driver"); } /* @@ -429,7 +429,7 @@ static void ieee_out(int32_t segto, const void *data, if (seg->index == segto) break; if (!seg) - nasm_error(ERR_PANIC, "code directed to nonexistent segment?"); + nasm_panic(0, "code directed to nonexistent segment?"); if (type == OUT_RAWDATA) { ucdata = data; @@ -535,7 +535,7 @@ static void ieee_write_fixup(int32_t segment, int32_t wrt, } } else - nasm_error(ERR_PANIC, + nasm_panic(0, "unrecognised WRT value in ieee_write_fixup"); } else nasm_error(ERR_NONFATAL, "target of WRT must be a section "); @@ -577,7 +577,7 @@ static void ieee_write_fixup(int32_t segment, int32_t wrt, */ if (eb) { if (realtype == OUT_REL2ADR || realtype == OUT_REL4ADR) { - nasm_error(ERR_PANIC, + nasm_panic(0, "Segment of a rel not supported in ieee_write_fixup"); } else { /* If we want the segment */ @@ -588,7 +588,7 @@ static void ieee_write_fixup(int32_t segment, int32_t wrt, } else /* If we get here the seg value doesn't make sense */ - nasm_error(ERR_PANIC, + nasm_panic(0, "unrecognised segment value in ieee_write_fixup"); } @@ -643,7 +643,7 @@ static void ieee_write_fixup(int32_t segment, int32_t wrt, } else /* If we get here the seg value doesn't make sense */ - nasm_error(ERR_PANIC, + nasm_panic(0, "unrecognised segment value in ieee_write_fixup"); } } @@ -994,7 +994,7 @@ static void ieee_write_file(int debuginfo) if (seg->index == ieee_entry_seg) break; if (!seg) - nasm_error(ERR_PANIC, "Start address records are incorrect"); + nasm_panic(0, "Start address records are incorrect"); else ieee_putascii("ASG,R%X,%lX,+.\n", seg->ieee_index, ieee_entry_ofs); @@ -1357,7 +1357,7 @@ static void dbgls_linnum(const char *lnfname, int32_t lineno, int32_t segto) if (!any_segs) { int tempint; /* ignored */ if (segto != ieee_segment("__NASMDEFSEG", 2, &tempint)) - nasm_error(ERR_PANIC, "strange segment conditions in OBJ driver"); + nasm_panic(0, "strange segment conditions in OBJ driver"); } /* @@ -1367,7 +1367,7 @@ static void dbgls_linnum(const char *lnfname, int32_t lineno, int32_t segto) if (seg->index == segto) break; if (!seg) - nasm_error(ERR_PANIC, "lineno directed to nonexistent segment?"); + nasm_panic(0, "lineno directed to nonexistent segment?"); for (fn = fnhead; fn; fn = fn->next) { if (!nasm_stricmp(lnfname, fn->name)) diff --git a/output/outmacho.c b/output/outmacho.c index 9a43114..b67561c 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -1139,7 +1139,7 @@ static void macho_calculate_sizes (void) } if (seg_nsects > MAX_SECT) { - nasm_error(ERR_FATAL, "MachO output is limited to %d sections\n", + nasm_fatal(0, "MachO output is limited to %d sections\n", MAX_SECT); } diff --git a/output/outobj.c b/output/outobj.c index ff03664..a39610b 100644 --- a/output/outobj.c +++ b/output/outobj.c @@ -840,7 +840,7 @@ static void obj_deflabel(char *name, int32_t segment, if (!any_segs && segment == first_seg) { int tempint; /* ignored */ if (segment != obj_segment("__NASMDEFSEG", 2, &tempint)) - nasm_error(ERR_PANIC, "strange segment conditions in OBJ driver"); + nasm_panic(0, "strange segment conditions in OBJ driver"); } for (seg = seghead; seg && is_global; seg = seg->next) @@ -1046,7 +1046,7 @@ static void obj_out(int32_t segto, const void *data, if (!any_segs) { int tempint; /* ignored */ if (segto != obj_segment("__NASMDEFSEG", 2, &tempint)) - nasm_error(ERR_PANIC, "strange segment conditions in OBJ driver"); + nasm_panic(0, "strange segment conditions in OBJ driver"); } /* @@ -1056,7 +1056,7 @@ static void obj_out(int32_t segto, const void *data, if (seg->index == segto) break; if (!seg) - nasm_error(ERR_PANIC, "code directed to nonexistent segment?"); + nasm_panic(0, "code directed to nonexistent segment?"); orp = seg->orp; orp->parm[0] = seg->currentpos; @@ -1193,7 +1193,7 @@ static void obj_write_fixup(ObjRecord * orp, int bytes, locat = FIX_16_SELECTOR; seg--; if (bytes != 2) - nasm_error(ERR_PANIC, "OBJ: 4-byte segment base fixup got" + nasm_panic(0, "OBJ: 4-byte segment base fixup got" " through sanity check"); } else { base = false; @@ -1239,7 +1239,7 @@ static void obj_write_fixup(ObjRecord * orp, int bytes, if (eb) method = 6, e = eb->exts[i], tidx = e->index; else - nasm_error(ERR_PANIC, + nasm_panic(0, "unrecognised segment value in obj_write_fixup"); } } @@ -1298,7 +1298,7 @@ static void obj_write_fixup(ObjRecord * orp, int bytes, if (eb) method |= 0x20, fidx = eb->exts[i]->index; else - nasm_error(ERR_PANIC, + nasm_panic(0, "unrecognised WRT value in obj_write_fixup"); } } @@ -1447,7 +1447,7 @@ static int32_t obj_segment(char *name, int pass, int *bits) if (!strcmp(grp->name, "FLAT")) break; if (!grp) - nasm_error(ERR_PANIC, "failure to define FLAT?!"); + nasm_panic(0, "failure to define FLAT?!"); } seg->grp = grp; } else if (!nasm_strnicmp(p, "class=", 6)) @@ -2457,7 +2457,7 @@ static void dbgbi_linnum(const char *lnfname, int32_t lineno, int32_t segto) if (!any_segs) { int tempint; /* ignored */ if (segto != obj_segment("__NASMDEFSEG", 2, &tempint)) - nasm_error(ERR_PANIC, "strange segment conditions in OBJ driver"); + nasm_panic(0, "strange segment conditions in OBJ driver"); } /* @@ -2467,7 +2467,7 @@ static void dbgbi_linnum(const char *lnfname, int32_t lineno, int32_t segto) if (seg->index == segto) break; if (!seg) - nasm_error(ERR_PANIC, "lineno directed to nonexistent segment?"); + nasm_panic(0, "lineno directed to nonexistent segment?"); /* for (fn = fnhead; fn; fn = fnhead->next) */ for (fn = fnhead; fn; fn = fn->next) /* fbk - Austin Lunnen - John Fine */ diff --git a/output/outrdf2.c b/output/outrdf2.c index 4dcae83..e6dcda9 100644 --- a/output/outrdf2.c +++ b/output/outrdf2.c @@ -145,7 +145,7 @@ static void rdf2_init(void) segdata = seg_alloc(); segbss = seg_alloc(); if (segtext != 0 || segdata != 2 || segbss != 4) - nasm_error(ERR_PANIC, + nasm_panic(0, "rdf segment numbers not allocated as expected (%d,%d,%d)", segtext, segdata, segbss); bsslength = 0; @@ -227,7 +227,7 @@ static int32_t rdf2_section_names(char *name, int pass, int *bits) code = 3; } if (nsegments == RDF_MAXSEGS) { - nasm_error(ERR_FATAL, "reached compiled-in maximum segment limit (%d)", + nasm_fatal(0, "reached compiled-in maximum segment limit (%d)", RDF_MAXSEGS); return NO_SEG; } @@ -235,7 +235,7 @@ static int32_t rdf2_section_names(char *name, int pass, int *bits) segments[nsegments].segname = nasm_strdup(name); i = seg_alloc(); if (i % 2 != 0) - nasm_error(ERR_PANIC, "seg_alloc() returned odd number"); + nasm_panic(0, "seg_alloc() returned odd number"); segments[nsegments].segnumber = i >> 1; segments[nsegments].segtype = code; segments[nsegments].segreserved = reserved; @@ -497,7 +497,7 @@ static void membufwrite(int segment, const void *data, int bytes) break; } if (i == nsegments) - nasm_error(ERR_PANIC, "can't find segment %d", segment); + nasm_panic(0, "can't find segment %d", segment); if (bytes < 0) { b = buf; @@ -520,7 +520,7 @@ static int getsegmentlength(int segment) break; } if (i == nsegments) - nasm_error(ERR_PANIC, "can't find segment %d", segment); + nasm_panic(0, "can't find segment %d", segment); return segments[i].seglength; } @@ -577,7 +577,7 @@ static void rdf2_out(int32_t segto, const void *data, membufwrite(segto, databuf, 1); } else if (type == OUT_RAWDATA) { if (segment != NO_SEG) - nasm_error(ERR_PANIC, "OUT_RAWDATA with other than NO_SEG"); + nasm_panic(0, "OUT_RAWDATA with other than NO_SEG"); membufwrite(segto, data, size); } else if (type == OUT_ADDRESS) { @@ -606,7 +606,7 @@ static void rdf2_out(int32_t segto, const void *data, membufwrite(segto, databuf, asize); } else if (type == OUT_REL2ADR) { if (segment == segto) - nasm_error(ERR_PANIC, "intra-segment OUT_REL2ADR"); + nasm_panic(0, "intra-segment OUT_REL2ADR"); rr.reclen = 8; rr.offset = getsegmentlength(segto); /* current offset */ @@ -638,9 +638,9 @@ static void rdf2_out(int32_t segto, const void *data, membufwrite(segto, &rr.offset, -2); } else if (type == OUT_REL4ADR) { if ((segment == segto) && (globalbits != 64)) - nasm_error(ERR_PANIC, "intra-segment OUT_REL4ADR"); + nasm_panic(0, "intra-segment OUT_REL4ADR"); if (segment != NO_SEG && segment % 2) { - nasm_error(ERR_PANIC, "erm... 4 byte segment base ref?"); + nasm_panic(0, "erm... 4 byte segment base ref?"); } rr.type = RDFREC_RELOC; /* type signature */ diff --git a/parser.c b/parser.c index 423d785..50bfdf6 100644 --- a/parser.c +++ b/parser.c @@ -107,7 +107,7 @@ static int prefix_slot(int prefix) case P_VEX2: return PPS_VEX; default: - nasm_error(ERR_PANIC, "Invalid value %d passed to prefix_slot()", prefix); + nasm_panic(0, "Invalid value %d passed to prefix_slot()", prefix); return -1; } } diff --git a/preproc-nop.c b/preproc-nop.c index b43bd80..4d04af5 100644 --- a/preproc-nop.c +++ b/preproc-nop.c @@ -66,7 +66,7 @@ static void nop_reset(char *file, int pass, ListGen *listgen, StrList **deplist) nop_fp = fopen(file, "r"); if (!nop_fp) - nasm_error(ERR_FATAL | ERR_NOFILE, + nasm_fatal(ERR_NOFILE, "unable to open input file `%s'", file); nop_list = listgen; (void)pass; /* placate compilers */ diff --git a/preproc.c b/preproc.c index 4e05298..054cc20 100644 --- a/preproc.c +++ b/preproc.c @@ -5024,7 +5024,7 @@ static char *pp_getline(void) fclose(i->fp); if (i->conds) { /* nasm_error can't be conditionally suppressed */ - nasm_error(ERR_FATAL, + nasm_fatal(0, "expected `%%endif' before end of file"); } /* only set line and file name if there's a next node */ |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-03-03 23:27:20
|
Commit-ID: d6d1b658263a035beb592a794184bf2e0ea1ef01 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=d6d1b658263a035beb592a794184bf2e0ea1ef01 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Thu, 3 Mar 2016 14:36:01 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Thu, 3 Mar 2016 15:22:03 -0800 Additional ERR_PANIC/ERR_FATAL -> nasm_panic/nasm_fatal changes Additional places where we can change ERR_PANIC and ERR_FATAL to nasm_panic and nasm_fatal. Note that nasm_panic and nasm_fatal should *aways* be expected to be fatal; they should never be used in a suppressed context. It is critical that we verify that this doesn't break anything. Signed-off-by: H. Peter Anvin <hp...@zy...> --- assemble.c | 18 +++++++++--------- eval.c | 2 +- float.c | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/assemble.c b/assemble.c index a26f2bf..f051b26 100644 --- a/assemble.c +++ b/assemble.c @@ -347,7 +347,7 @@ static void out(int64_t offset, int32_t segto, const void *data, uint8_t *q = p; if (asize > 8) { - nasm_error(ERR_PANIC, "OUT_ADDRESS with size > 8"); + nasm_panic(0, "OUT_ADDRESS with size > 8"); return; } @@ -590,7 +590,7 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp, int64_t insn_size = calcsize(segment, offset, bits, instruction, temp); itimes = instruction->times; if (insn_size < 0) /* shouldn't be, on pass two */ - nasm_error(ERR_PANIC, "errors made it through from pass one"); + nasm_panic(0, "errors made it through from pass one"); else while (itimes--) { for (j = 0; j < MAXPREFIX; j++) { @@ -696,7 +696,7 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp, case P_none: break; default: - nasm_error(ERR_PANIC, "invalid instruction prefix"); + nasm_panic(0, "invalid instruction prefix"); } if (c != 0) { out(offset, segment, &c, OUT_RAWDATA, 1, @@ -1300,7 +1300,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits, break; default: - nasm_error(ERR_PANIC, "internal instruction table corrupt" + nasm_panic(0, "internal instruction table corrupt" ": instruction code \\%o (0x%02X) given", c, c); break; } @@ -1821,7 +1821,7 @@ static void gencode(int32_t segment, int64_t offset, int bits, case 0340: if (ins->oprs[0].segment != NO_SEG) - nasm_error(ERR_PANIC, "non-constant BSS size in pass two"); + nasm_panic(0, "non-constant BSS size in pass two"); else { int64_t size = ins->oprs[0].offset; if (size > 0) @@ -1966,7 +1966,7 @@ static void gencode(int32_t segment, int64_t offset, int bits, break; default: - nasm_error(ERR_PANIC, "internal instruction table corrupt" + nasm_panic(0, "internal instruction table corrupt" ": instruction code \\%o (0x%02X) given", c, c); break; } @@ -1976,14 +1976,14 @@ static void gencode(int32_t segment, int64_t offset, int bits, static opflags_t regflag(const operand * o) { if (!is_register(o->basereg)) - nasm_error(ERR_PANIC, "invalid operand passed to regflag()"); + nasm_panic(0, "invalid operand passed to regflag()"); return nasm_reg_flags[o->basereg]; } static int32_t regval(const operand * o) { if (!is_register(o->basereg)) - nasm_error(ERR_PANIC, "invalid operand passed to regval()"); + nasm_panic(0, "invalid operand passed to regval()"); return nasm_regvals[o->basereg]; } @@ -1993,7 +1993,7 @@ static int op_rexflags(const operand * o, int mask) int val; if (!is_register(o->basereg)) - nasm_error(ERR_PANIC, "invalid operand passed to op_rexflags()"); + nasm_panic(0, "invalid operand passed to op_rexflags()"); flags = nasm_reg_flags[o->basereg]; val = nasm_regvals[o->basereg]; diff --git a/eval.c b/eval.c index a8e463f..72e13c9 100644 --- a/eval.c +++ b/eval.c @@ -756,7 +756,7 @@ static int64_t eval_ifunc(int64_t val, enum ifunc func) break; default: - nasm_error(ERR_PANIC, "invalid IFUNC token %d", func); + nasm_panic(0, "invalid IFUNC token %d", func); rv = 0; break; } diff --git a/float.c b/float.c index adf18c5..e30e1ef 100644 --- a/float.c +++ b/float.c @@ -733,7 +733,7 @@ static int to_float(const char *str, int s, uint8_t *result, const char *strend; if (!str[0]) { - nasm_error(ERR_PANIC, + nasm_panic(0, "internal errror: empty string passed to float_const"); return 0; } @@ -916,7 +916,7 @@ int float_const(const char *number, int sign, uint8_t *result, int bytes) case 16: return to_float(number, sign, result, &ieee_128); default: - nasm_error(ERR_PANIC, "strange value %d passed to float_const", bytes); + nasm_panic(0, "strange value %d passed to float_const", bytes); return 0; } } |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-03-03 23:27:19
|
Commit-ID: 7f087afc6633197416c036976858ef3565ed3cc8 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=7f087afc6633197416c036976858ef3565ed3cc8 Author: H. Peter Anvin <hp...@li...> AuthorDate: Wed, 17 Feb 2016 16:10:41 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Thu, 3 Mar 2016 15:22:02 -0800 nasmlib: add nasm_fatal() like nasm_panic() Just like nasm_panic(), nasm_fatal() tells the compiler that we can never return from this call. >From master branch checkin bbbf50839479a63841169b8995f285fb1c8a3fc5 Signed-off-by: H. Peter Anvin <hp...@li...> --- nasmlib.c | 19 ++++++++++++++----- nasmlib.h | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/nasmlib.c b/nasmlib.c index cf39468..d19cbf6 100644 --- a/nasmlib.c +++ b/nasmlib.c @@ -83,6 +83,15 @@ void nasm_error(int severity, const char *fmt, ...) va_end(ap); } +no_return nasm_fatal(int flags, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + nasm_verror(flags | ERR_FATAL, fmt, ap); + abort(); /* We should never get here */ +} + no_return nasm_panic(int flags, const char *fmt, ...) { va_list ap; @@ -101,7 +110,7 @@ void *nasm_malloc(size_t size) { void *p = malloc(size); if (!p) - nasm_error(ERR_FATAL | ERR_NOFILE, "out of memory"); + nasm_fatal(ERR_NOFILE, "out of memory"); return p; } @@ -109,7 +118,7 @@ void *nasm_zalloc(size_t size) { void *p = calloc(size, 1); if (!p) - nasm_error(ERR_FATAL | ERR_NOFILE, "out of memory"); + nasm_fatal(ERR_NOFILE, "out of memory"); return p; } @@ -117,7 +126,7 @@ void *nasm_realloc(void *q, size_t size) { void *p = q ? realloc(q, size) : malloc(size); if (!p) - nasm_error(ERR_FATAL | ERR_NOFILE, "out of memory"); + nasm_fatal(ERR_NOFILE, "out of memory"); return p; } @@ -134,7 +143,7 @@ char *nasm_strdup(const char *s) p = malloc(size); if (!p) - nasm_error(ERR_FATAL | ERR_NOFILE, "out of memory"); + nasm_fatal(ERR_NOFILE, "out of memory"); strcpy(p, s); return p; } @@ -146,7 +155,7 @@ char *nasm_strndup(const char *s, size_t len) p = malloc(size); if (!p) - nasm_error(ERR_FATAL | ERR_NOFILE, "out of memory"); + nasm_fatal(ERR_NOFILE, "out of memory"); strncpy(p, s, len); p[len] = '\0'; return p; diff --git a/nasmlib.h b/nasmlib.h index 86766e3..2e2e807 100644 --- a/nasmlib.h +++ b/nasmlib.h @@ -77,6 +77,7 @@ typedef void (*efunc) (int severity, const char *fmt, ...); typedef void (*vefunc) (int severity, const char *fmt, va_list ap); void printf_func(2, 3) nasm_error(int severity, const char *fmt, ...); void nasm_set_verror(vefunc); +no_return printf_func(2, 3) nasm_fatal(int flags, const char *fmt, ...); no_return printf_func(2, 3) nasm_panic(int flags, const char *fmt, ...); no_return nasm_panic_from_macro(const char *file, int line); #define panic() nasm_panic_from_macro(__FILE__, __LINE__); |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-03-03 22:24:18
|
Commit-ID: c5b2de096436661892c13ec2c645e6d643c800f7 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=c5b2de096436661892c13ec2c645e6d643c800f7 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Thu, 3 Mar 2016 14:15:41 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Thu, 3 Mar 2016 14:15:41 -0800 codeview: be a bit more explicit about the nature of a panic When we have to die due to an assertion violation, then show the missing symbol. Also, use nasm_panic() rather than nasm_assert() for this purpose. Signed-off-by: H. Peter Anvin <hp...@zy...> --- output/codeview.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/output/codeview.c b/output/codeview.c index 86050ec..b5c205c 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -417,7 +417,7 @@ static void register_reloc(struct coff_Section *const sect, return; } } - nasm_assert(!"relocation for unregistered symbol"); + nasm_panic(0, "codeview: relocation for unregistered symbol: %s", sym); } static inline void section_write32(struct coff_Section *sect, uint32_t val) |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-03-03 20:45:18
|
Commit-ID: c5b95dd5d435e4ec5ff74f5c85aedef90a73bef1 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=c5b95dd5d435e4ec5ff74f5c85aedef90a73bef1 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Thu, 3 Mar 2016 12:43:02 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Thu, 3 Mar 2016 12:43:02 -0800 changes.src: begin documentation for 2.12.01 We probably ought to release 2.12.01 in the short term. So far the changes that have accumulated have all been build fixes. Signed-off-by: H. Peter Anvin <hp...@zy...> --- doc/changes.src | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/changes.src b/doc/changes.src index c6738b9..9f1c563 100644 --- a/doc/changes.src +++ b/doc/changes.src @@ -7,6 +7,12 @@ The NASM 2 series supports x86-64, and is the production version of NASM since 2007. + +\S{cl-2.12.01} Version 2.12.01 + +\b Portability fixes for some platforms. + + \S{cl-2.12} Version 2.12 \b Major fixes to the \c{macho} backend (\k{machofmt}); earlier versions |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-03-03 20:42:20
|
Commit-ID: fdf0d073104454fcb57617c339205730a47a60c9 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=fdf0d073104454fcb57617c339205730a47a60c9 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Thu, 3 Mar 2016 12:39:02 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Thu, 3 Mar 2016 12:39:02 -0800 Make --disable-werror work autoconf's handling of --without and --disable are a bit counterintuitive: instead of calling the "not given" branch of the conditional, they instead call the "given" part of the conditional with an argument of "no". Make --disable-werror work as expected. Signed-off-by: H. Peter Anvin <hp...@zy...> --- configure.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.in b/configure.in index 01c0f07..86d2af9 100644 --- a/configure.in +++ b/configure.in @@ -186,6 +186,8 @@ PA_ADD_CFLAGS([-pedantic]) AC_ARG_ENABLE([werror], [AC_HELP_STRING([--enable-werror], [compile with -Werror to error out on any warning])], +[], [enable_werror=no]) +AS_IF([test x"$enable_werror" != xno], [PA_ADD_CFLAGS([-Werror])], [PA_ADD_CFLAGS([-Werror=implicit]) PA_ADD_CFLAGS([-Werror=missing-braces]) |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-03-03 20:30:19
|
Commit-ID: 54469e27d0565ceab1cce273cd120c4d4055a509 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=54469e27d0565ceab1cce273cd120c4d4055a509 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Thu, 3 Mar 2016 12:29:25 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Thu, 3 Mar 2016 12:29:25 -0800 outmacho: remove unused debugging functions Remove unused debugging functions, and the _unused macro which turned out to cause compilation problems on Linux/PowerPC. Signed-off-by: H. Peter Anvin <hp...@zy...> --- compiler.h | 6 ------ output/outmacho.c | 27 --------------------------- 2 files changed, 33 deletions(-) diff --git a/compiler.h b/compiler.h index 4a68576..7daf6ec 100644 --- a/compiler.h +++ b/compiler.h @@ -81,12 +81,6 @@ # endif #endif -#ifdef __GNUC__ -# define _unused __attribute__((unused)) -#else -# define _unused -#endif - /* Some versions of MSVC have these only with underscores in front */ #include <stddef.h> #include <stdarg.h> diff --git a/output/outmacho.c b/output/outmacho.c index 746dbcb..9a43114 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -300,9 +300,6 @@ static uint64_t rel_padcnt = 0; #define alignptr(x) \ ALIGN(x, fmt.ptrsize) /* align x to output format width */ -static void debug_reloc (struct reloc *); -static void debug_section_relocs (struct section *) _unused; - static struct section *get_section_by_name(const char *segname, const char *sectname) { @@ -1595,30 +1592,6 @@ static void macho_cleanup(int debuginfo) nasm_free(sectstab); } -/* Debugging routines. */ -static void debug_reloc (struct reloc *r) -{ - fprintf (stdout, "reloc:\n"); - fprintf (stdout, "\taddr: %"PRId32"\n", r->addr); - fprintf (stdout, "\tsnum: %d\n", r->snum); - fprintf (stdout, "\tpcrel: %d\n", r->pcrel); - fprintf (stdout, "\tlength: %d\n", r->length); - fprintf (stdout, "\text: %d\n", r->ext); - fprintf (stdout, "\ttype: %d\n", r->type); -} - -static void debug_section_relocs (struct section *s) -{ - struct reloc *r = s->relocs; - - fprintf (stdout, "relocs for section %s:\n\n", s->sectname); - - while (r != NULL) { - debug_reloc (r); - r = r->next; - } -} - #ifdef OF_MACHO32 static const struct macho_fmt macho32_fmt = { 4, |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-03-02 19:03:24
|
Commit-ID: 7214d18b405f883010a74a3f8281c7906a5a21ca Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=7214d18b405f883010a74a3f8281c7906a5a21ca Author: H. Peter Anvin <hp...@zy...> AuthorDate: Tue, 1 Mar 2016 22:43:51 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Tue, 1 Mar 2016 22:43:51 -0800 Remove unnecessary C99-isms In order to make it more likely to compile cleanly with "C90 plus long long" style compilers, make gcc warn for incompatible constructs. Remove existing constructs (mostly commas at the end of enums) that aren't compliant. Ironically enough this was most likely an unintentional omission in C90... Signed-off-by: H. Peter Anvin <hp...@zy...> --- float.h | 2 +- nasm.c | 2 +- nasm.h | 24 ++++++++++++------------ output/codeview.c | 4 ++-- output/outelf32.c | 2 +- output/outmacho.c | 2 +- output/stabs.h | 6 +++--- pptok.pl | 6 ++++-- quote.c | 6 +++--- 9 files changed, 28 insertions(+), 26 deletions(-) diff --git a/float.h b/float.h index a00a043..b07e542 100644 --- a/float.h +++ b/float.h @@ -45,7 +45,7 @@ enum float_round { FLOAT_RC_NEAR, FLOAT_RC_ZERO, FLOAT_RC_DOWN, - FLOAT_RC_UP, + FLOAT_RC_UP }; int float_const(const char *string, int sign, uint8_t *result, int bytes); diff --git a/nasm.c b/nasm.c index bff3b49..20e01b6 100644 --- a/nasm.c +++ b/nasm.c @@ -615,7 +615,7 @@ struct textargs { enum text_options { OPT_PREFIX, - OPT_POSTFIX, + OPT_POSTFIX }; static const struct textargs textopts[] = { {"prefix", OPT_PREFIX}, diff --git a/nasm.h b/nasm.h index 9e4fa96..77c90b0 100644 --- a/nasm.h +++ b/nasm.h @@ -106,7 +106,7 @@ enum out_type { OUT_REL1ADR, /* 1-byte relative address */ OUT_REL2ADR, /* 2-byte relative address */ OUT_REL4ADR, /* 4-byte relative address */ - OUT_REL8ADR, /* 8-byte relative address */ + OUT_REL8ADR /* 8-byte relative address */ }; /* @@ -164,7 +164,7 @@ enum token_type { /* token types, other than chars */ TOKEN_STRFUNC, /* __utf16*__, __utf32*__ */ TOKEN_IFUNC, /* __ilog2*__ */ TOKEN_DECORATOR, /* decorators such as {...} */ - TOKEN_OPMASK, /* translated token for opmask registers */ + TOKEN_OPMASK /* translated token for opmask registers */ }; enum floatize { @@ -175,7 +175,7 @@ enum floatize { FLOAT_80M, FLOAT_80E, FLOAT_128L, - FLOAT_128H, + FLOAT_128H }; /* Must match the list in string_transform(), in strfunc.c */ @@ -185,14 +185,14 @@ enum strfunc { STRFUNC_UTF16BE, STRFUNC_UTF32, STRFUNC_UTF32LE, - STRFUNC_UTF32BE, + STRFUNC_UTF32BE }; enum ifunc { IFUNC_ILOG2E, IFUNC_ILOG2W, IFUNC_ILOG2F, - IFUNC_ILOG2C, + IFUNC_ILOG2C }; size_t string_transform(char *, size_t, char **, enum strfunc); @@ -471,7 +471,7 @@ static inline uint8_t get_cond_opcode(enum ccode c) enum vex_class { RV_VEX = 0, /* C4/C5 */ RV_XOP = 1, /* 8F */ - RV_EVEX = 2, /* 62 */ + RV_EVEX = 2 /* 62 */ }; /* @@ -516,7 +516,7 @@ enum extop_type { /* extended operand types */ EOT_NOTHING, EOT_DB_STRING, /* Byte string */ EOT_DB_STRING_FREE, /* Byte string which should be nasm_free'd*/ - EOT_DB_NUMBER, /* Integer */ + EOT_DB_NUMBER /* Integer */ }; enum ea_flags { /* special EA flags */ @@ -526,14 +526,14 @@ enum ea_flags { /* special EA flags */ EAF_REL = 8, /* IP-relative addressing */ EAF_ABS = 16, /* non-IP-relative addressing */ EAF_FSGS = 32, /* fs/gs segment override present */ - EAF_MIB = 64, /* mib operand */ + EAF_MIB = 64 /* mib operand */ }; enum eval_hint { /* values for `hinttype' */ EAH_NOHINT = 0, /* no hint at all - our discretion */ EAH_MAKEBASE = 1, /* try to make given reg the base */ EAH_NOTBASE = 2, /* try _not_ to make reg the base */ - EAH_SUMMED = 3, /* base and index are summed into index */ + EAH_SUMMED = 3 /* base and index are summed into index */ }; typedef struct operand { /* operand to an instruction */ @@ -573,7 +573,7 @@ enum ea_type { EA_SCALAR, /* Scalar EA */ EA_XMMVSIB, /* XMM vector EA */ EA_YMMVSIB, /* YMM vector EA */ - EA_ZMMVSIB, /* ZMM vector EA */ + EA_ZMMVSIB /* ZMM vector EA */ }; /* @@ -617,7 +617,7 @@ enum ttypes { QVM = 015, OVM = 016, M128 = 017, - DUP = 020, + DUP = 020 }; /* EVEX.L'L : Vector length on vector insns */ @@ -625,7 +625,7 @@ enum vectlens { VL128 = 0, VL256 = 1, VL512 = 2, - VLMAX = 3, + VLMAX = 3 }; /* If you need to change this, also change it in insns.pl */ diff --git a/output/codeview.c b/output/codeview.c index d1828a5..2df6b05 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -89,7 +89,7 @@ enum symbol_type { SYMTYPE_LDATA, SYMTYPE_GDATA, - SYMTYPE_MAX, + SYMTYPE_MAX }; struct cv8_symbol { @@ -113,7 +113,7 @@ struct cv8_symbol { TYPE_REAL80 = 0x0042, TYPE_REAL128= 0x0043, TYPE_REAL256= 0x0044, - TYPE_REAL512= 0x0045, + TYPE_REAL512= 0x0045 } symtype; }; diff --git a/output/outelf32.c b/output/outelf32.c index 24efc0f..455f2b9 100644 --- a/output/outelf32.c +++ b/output/outelf32.c @@ -1160,7 +1160,7 @@ static struct SAA *elf_build_symtab(int32_t *len, int32_t *local) * dwarf needs symbols for debug sections * which are relocation targets. */ -//*** fix for 32 bit + /*** fix for 32 bit ***/ if (dfmt == &df_dwarf) { dwarf_infosym = *local; p = entry; diff --git a/output/outmacho.c b/output/outmacho.c index 56b53d4..8ad52c2 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -114,7 +114,7 @@ enum reltype { RL_BRANCH, /* Relative direct branch */ RL_SUB, /* X86_64_RELOC_SUBTRACT */ RL_GOT, /* X86_64_RELOC_GOT */ - RL_GOTLOAD, /* X86_64_RELOC_GOT_LOAD */ + RL_GOTLOAD /* X86_64_RELOC_GOT_LOAD */ }; #define RL_MAX_32 RL_TLV #define RL_MAX_64 RL_GOTLOAD diff --git a/output/stabs.h b/output/stabs.h index 1480d88..3a09c41 100644 --- a/output/stabs.h +++ b/output/stabs.h @@ -48,7 +48,7 @@ enum stab_offsets { STAB_otheroff = 5, STAB_descoff = 6, STAB_valoff = 8, - STAB_stabsize = 12, + STAB_stabsize = 12 }; /* stab/non-stab types */ @@ -127,7 +127,7 @@ enum stab_types { N_NBBSS = 0xf4, N_NBSTS = 0xf6, N_NBLCS = 0xf8, - N_LENG = 0xfe, + N_LENG = 0xfe }; enum stab_source_file { @@ -139,7 +139,7 @@ enum stab_source_file { N_SO_PASCAL = 0x06, N_SO_FORTRAN90 = 0x07, N_SO_OBJC = 0x32, - N_SO_OBJCPLUS = 0x33, + N_SO_OBJCPLUS = 0x33 }; #endif /* STABS_H_ */ diff --git a/pptok.pl b/pptok.pl index 2dbf0fe..53a1c92 100755 --- a/pptok.pl +++ b/pptok.pl @@ -110,13 +110,15 @@ if ($what eq 'h') { print OUT "enum pp_conditional {\n"; $n = 0; + $c = ''; foreach $cc (@cond) { if (defined($cc)) { - printf OUT " %-16s = %3d,\n", "PPC_IF\U$cc\E", $n; + printf OUT "$c %-16s = %3d", "PPC_IF\U$cc\E", $n; + $c = ','; } $n += 2; } - print OUT "};\n\n"; + print OUT "\n};\n\n"; printf OUT "#define PP_COND(x) ((enum pp_conditional)((x) & 0x%x))\n", (scalar(@cond)-1) << 1; diff --git a/quote.c b/quote.c index 0132b05..d1cbfd4 100644 --- a/quote.c +++ b/quote.c @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- * * - * Copyright 1996-2009 The NASM Authors - All Rights Reserved + * Copyright 1996-2016 The NASM Authors - All Rights Reserved * See the file AUTHORS included with the NASM distribution for * the specific copyright holders. * @@ -235,7 +235,7 @@ size_t nasm_unquote(char *str, char **ep) st_backslash, st_hex, st_oct, - st_ucs, + st_ucs } state; int ndig = 0; int32_t nval = 0; @@ -430,7 +430,7 @@ char *nasm_skip_string(char *str) char c; enum unq_state { st_start, - st_backslash, + st_backslash } state; bq = str[0]; |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-03-02 18:57:16
|
Commit-ID: 140c214ad04a51dab937cda1fe1ea4b9d60fb86d Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=140c214ad04a51dab937cda1fe1ea4b9d60fb86d Author: H. Peter Anvin <hp...@zy...> AuthorDate: Wed, 2 Mar 2016 10:54:24 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Wed, 2 Mar 2016 10:54:24 -0800 md5: use "compiler.h", WORDS_LITTLEENDIAN and make functions static Look for WORDS_LITTLEENDIAN instead of the gcc-specific __BYTE_ORDER. Use our existing "compiler.h" portability layer. Make functions which are not exported static. Signed-off-by: H. Peter Anvin <hp...@zy...> --- md5.h | 9 ++++----- md5c.c | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/md5.h b/md5.h index ea34cda..fb6ac60 100644 --- a/md5.h +++ b/md5.h @@ -1,6 +1,7 @@ -#ifndef _MD5_H_ -#define _MD5_H_ +#ifndef MD5_H +#define MD5_H +#include "compiler.h" #include <inttypes.h> #define MD5_HASHBYTES 16 @@ -17,7 +18,5 @@ extern void MD5Update(MD5_CTX *context, unsigned char const *buf, extern void MD5Final(unsigned char digest[MD5_HASHBYTES], MD5_CTX *context); extern void MD5Transform(uint32_t buf[4], uint32_t const in[16]); extern char * MD5End(MD5_CTX *, char *); -extern char * MD5File(const char *, char *); -extern char * MD5Data (const unsigned char *, unsigned int, char *); -#endif /* !_MD5_H_ */ +#endif /* !MD5_H */ diff --git a/md5c.c b/md5c.c index 2716232..5d5c91a 100644 --- a/md5c.c +++ b/md5c.c @@ -15,18 +15,18 @@ * will fill a supplied 16-byte array with the digest. */ -#include <string.h> /* for memcpy() */ #include "md5.h" +#include <string.h> /* for memcpy() */ -#if __BYTE_ORDER == 1234 +#ifdef WORDS_LITTEENDIAN #define byteReverse(buf, len) /* Nothing */ #else -void byteReverse(unsigned char *buf, unsigned longs); +static void byteReverse(unsigned char *buf, unsigned longs); /* * Note: this code is harmless on little-endian machines. */ -void byteReverse(unsigned char *buf, unsigned longs) +static void byteReverse(unsigned char *buf, unsigned longs) { uint32_t t; do { |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-03-02 18:51:21
|
Commit-ID: 53f1559c06d8ca5578c61d3897d131b83f841689 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=53f1559c06d8ca5578c61d3897d131b83f841689 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Tue, 1 Mar 2016 22:43:51 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Wed, 2 Mar 2016 10:48:53 -0800 Remove unnecessary C99-isms In order to make it more likely to compile cleanly with "C90 plus long long" style compilers, remove existing constructs (mostly commas at the end of enums) that aren't compliant. Ironically enough this was most likely an unintentional omission in C90... >From master branch checkin 7214d18b405f883010a74a3f8281c7906a5a21ca Resolved Conflicts: output/outelf32.c Signed-off-by: H. Peter Anvin <hp...@zy...> --- float.h | 2 +- nasm.c | 2 +- nasm.h | 24 ++++++++++++------------ output/codeview.c | 4 ++-- output/outelf32.c | 2 +- output/outmacho.c | 2 +- output/stabs.h | 6 +++--- pptok.pl | 6 ++++-- quote.c | 6 +++--- 9 files changed, 28 insertions(+), 26 deletions(-) diff --git a/float.h b/float.h index 6f94cc6..6823cd4 100644 --- a/float.h +++ b/float.h @@ -45,7 +45,7 @@ enum float_round { FLOAT_RC_NEAR, FLOAT_RC_ZERO, FLOAT_RC_DOWN, - FLOAT_RC_UP, + FLOAT_RC_UP }; int float_const(const char *string, int sign, uint8_t *result, int bytes, diff --git a/nasm.c b/nasm.c index 469cd51..5556e06 100644 --- a/nasm.c +++ b/nasm.c @@ -614,7 +614,7 @@ struct textargs { enum text_options { OPT_PREFIX, - OPT_POSTFIX, + OPT_POSTFIX }; struct textargs textopts[] = { {"prefix", OPT_PREFIX}, diff --git a/nasm.h b/nasm.h index f0cc346..48284f6 100644 --- a/nasm.h +++ b/nasm.h @@ -106,7 +106,7 @@ enum out_type { OUT_REL1ADR, /* 1-byte relative address */ OUT_REL2ADR, /* 2-byte relative address */ OUT_REL4ADR, /* 4-byte relative address */ - OUT_REL8ADR, /* 8-byte relative address */ + OUT_REL8ADR /* 8-byte relative address */ }; /* @@ -228,7 +228,7 @@ enum token_type { /* token types, other than chars */ TOKEN_STRFUNC, /* __utf16*__, __utf32*__ */ TOKEN_IFUNC, /* __ilog2*__ */ TOKEN_DECORATOR, /* decorators such as {...} */ - TOKEN_OPMASK, /* translated token for opmask registers */ + TOKEN_OPMASK /* translated token for opmask registers */ }; enum floatize { @@ -239,7 +239,7 @@ enum floatize { FLOAT_80M, FLOAT_80E, FLOAT_128L, - FLOAT_128H, + FLOAT_128H }; /* Must match the list in string_transform(), in strfunc.c */ @@ -249,14 +249,14 @@ enum strfunc { STRFUNC_UTF16BE, STRFUNC_UTF32, STRFUNC_UTF32LE, - STRFUNC_UTF32BE, + STRFUNC_UTF32BE }; enum ifunc { IFUNC_ILOG2E, IFUNC_ILOG2W, IFUNC_ILOG2F, - IFUNC_ILOG2C, + IFUNC_ILOG2C }; size_t string_transform(char *, size_t, char **, enum strfunc); @@ -534,7 +534,7 @@ static inline uint8_t get_cond_opcode(enum ccode c) enum vex_class { RV_VEX = 0, /* C4/C5 */ RV_XOP = 1, /* 8F */ - RV_EVEX = 2, /* 62 */ + RV_EVEX = 2 /* 62 */ }; /* @@ -575,7 +575,7 @@ enum extop_type { /* extended operand types */ EOT_NOTHING, EOT_DB_STRING, /* Byte string */ EOT_DB_STRING_FREE, /* Byte string which should be nasm_free'd*/ - EOT_DB_NUMBER, /* Integer */ + EOT_DB_NUMBER /* Integer */ }; enum ea_flags { /* special EA flags */ @@ -585,14 +585,14 @@ enum ea_flags { /* special EA flags */ EAF_REL = 8, /* IP-relative addressing */ EAF_ABS = 16, /* non-IP-relative addressing */ EAF_FSGS = 32, /* fs/gs segment override present */ - EAF_MIB = 64, /* mib operand */ + EAF_MIB = 64 /* mib operand */ }; enum eval_hint { /* values for `hinttype' */ EAH_NOHINT = 0, /* no hint at all - our discretion */ EAH_MAKEBASE = 1, /* try to make given reg the base */ EAH_NOTBASE = 2, /* try _not_ to make reg the base */ - EAH_SUMMED = 3, /* base and index are summed into index */ + EAH_SUMMED = 3 /* base and index are summed into index */ }; typedef struct operand { /* operand to an instruction */ @@ -632,7 +632,7 @@ enum ea_type { EA_SCALAR, /* Scalar EA */ EA_XMMVSIB, /* XMM vector EA */ EA_YMMVSIB, /* YMM vector EA */ - EA_ZMMVSIB, /* ZMM vector EA */ + EA_ZMMVSIB /* ZMM vector EA */ }; /* @@ -676,7 +676,7 @@ enum ttypes { QVM = 015, OVM = 016, M128 = 017, - DUP = 020, + DUP = 020 }; /* EVEX.L'L : Vector length on vector insns */ @@ -684,7 +684,7 @@ enum vectlens { VL128 = 0, VL256 = 1, VL512 = 2, - VLMAX = 3, + VLMAX = 3 }; /* If you need to change this, also change it in insns.pl */ diff --git a/output/codeview.c b/output/codeview.c index 975eef9..86050ec 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -89,7 +89,7 @@ enum symbol_type { SYMTYPE_LDATA, SYMTYPE_GDATA, - SYMTYPE_MAX, + SYMTYPE_MAX }; struct cv8_symbol { @@ -113,7 +113,7 @@ struct cv8_symbol { TYPE_REAL80 = 0x0042, TYPE_REAL128= 0x0043, TYPE_REAL256= 0x0044, - TYPE_REAL512= 0x0045, + TYPE_REAL512= 0x0045 } symtype; }; diff --git a/output/outelf32.c b/output/outelf32.c index e4971ed..a8b181a 100644 --- a/output/outelf32.c +++ b/output/outelf32.c @@ -1162,7 +1162,7 @@ static struct SAA *elf_build_symtab(int32_t *len, int32_t *local) * dwarf needs symbols for debug sections * which are relocation targets. */ -//*** fix for 32 bit + /*** fix for 32 bit ***/ if (of_elf32.current_dfmt == &df_dwarf) { dwarf_infosym = *local; p = entry; diff --git a/output/outmacho.c b/output/outmacho.c index 881a4ae..746dbcb 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -114,7 +114,7 @@ enum reltype { RL_BRANCH, /* Relative direct branch */ RL_SUB, /* X86_64_RELOC_SUBTRACT */ RL_GOT, /* X86_64_RELOC_GOT */ - RL_GOTLOAD, /* X86_64_RELOC_GOT_LOAD */ + RL_GOTLOAD /* X86_64_RELOC_GOT_LOAD */ }; #define RL_MAX_32 RL_TLV #define RL_MAX_64 RL_GOTLOAD diff --git a/output/stabs.h b/output/stabs.h index 1480d88..3a09c41 100644 --- a/output/stabs.h +++ b/output/stabs.h @@ -48,7 +48,7 @@ enum stab_offsets { STAB_otheroff = 5, STAB_descoff = 6, STAB_valoff = 8, - STAB_stabsize = 12, + STAB_stabsize = 12 }; /* stab/non-stab types */ @@ -127,7 +127,7 @@ enum stab_types { N_NBBSS = 0xf4, N_NBSTS = 0xf6, N_NBLCS = 0xf8, - N_LENG = 0xfe, + N_LENG = 0xfe }; enum stab_source_file { @@ -139,7 +139,7 @@ enum stab_source_file { N_SO_PASCAL = 0x06, N_SO_FORTRAN90 = 0x07, N_SO_OBJC = 0x32, - N_SO_OBJCPLUS = 0x33, + N_SO_OBJCPLUS = 0x33 }; #endif /* STABS_H_ */ diff --git a/pptok.pl b/pptok.pl index 2dbf0fe..53a1c92 100755 --- a/pptok.pl +++ b/pptok.pl @@ -110,13 +110,15 @@ if ($what eq 'h') { print OUT "enum pp_conditional {\n"; $n = 0; + $c = ''; foreach $cc (@cond) { if (defined($cc)) { - printf OUT " %-16s = %3d,\n", "PPC_IF\U$cc\E", $n; + printf OUT "$c %-16s = %3d", "PPC_IF\U$cc\E", $n; + $c = ','; } $n += 2; } - print OUT "};\n\n"; + print OUT "\n};\n\n"; printf OUT "#define PP_COND(x) ((enum pp_conditional)((x) & 0x%x))\n", (scalar(@cond)-1) << 1; diff --git a/quote.c b/quote.c index 0132b05..d1cbfd4 100644 --- a/quote.c +++ b/quote.c @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- * * - * Copyright 1996-2009 The NASM Authors - All Rights Reserved + * Copyright 1996-2016 The NASM Authors - All Rights Reserved * See the file AUTHORS included with the NASM distribution for * the specific copyright holders. * @@ -235,7 +235,7 @@ size_t nasm_unquote(char *str, char **ep) st_backslash, st_hex, st_oct, - st_ucs, + st_ucs } state; int ndig = 0; int32_t nval = 0; @@ -430,7 +430,7 @@ char *nasm_skip_string(char *str) char c; enum unq_state { st_start, - st_backslash, + st_backslash } state; bq = str[0]; |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-03-02 06:24:22
|
Commit-ID: ef63588eb483f96550d5a6d097363ff6e7a733f4 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=ef63588eb483f96550d5a6d097363ff6e7a733f4 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Tue, 1 Mar 2016 21:53:09 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Tue, 1 Mar 2016 21:53:09 -0800 configure.in: if byte order is unknown or ill defined, don't define any We can always operate correctly if neither WORDS_BIGENDIAN nor WORDS_LITTLEENDIAN are defined, so if the word order is either indeterminable or universal (the compiler generates both bigendian and litteendian output from the same sources) then define neither. Signed-off-by: H. Peter Anvin <hp...@zy...> --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index e13eeff..a4b52d0 100644 --- a/configure.in +++ b/configure.in @@ -67,7 +67,7 @@ AC_C_CONST AC_C_INLINE AC_C_RESTRICT AC_TYPE_SIZE_T -AC_C_BIGENDIAN(AC_DEFINE(WORDS_BIGENDIAN),AC_DEFINE(WORDS_LITTLEENDIAN)) +AC_C_BIGENDIAN(AC_DEFINE(WORDS_BIGENDIAN),AC_DEFINE(WORDS_LITTLEENDIAN),,) AH_TEMPLATE(WORDS_BIGENDIAN, [Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX).]) |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-03-02 06:24:21
|
Commit-ID: 25da6eaf434705a6ad01f252132dc7f109493c67 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=25da6eaf434705a6ad01f252132dc7f109493c67 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Tue, 1 Mar 2016 22:20:10 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Tue, 1 Mar 2016 22:20:10 -0800 configure: enable additional code cleanliness warnings We are supposed to handle compiling on a "C90 plus long long" compiler, so make gcc (our most common development platform compiler) complain when we don't. However, suppress the complaints about the Microsoft definitions of the <inttypes.h> strings. Signed-off-by: H. Peter Anvin <hp...@zy...> --- aclocal.m4 | 3 ++- configure.in | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/aclocal.m4 b/aclocal.m4 index d8d8ed7..6ef19e1 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -9,7 +9,8 @@ AC_DEFUN(PA_ADD_CFLAGS, CFLAGS="$CFLAGS $1" AC_TRY_LINK([#include <stdio.h>], [printf("Hello, World!\n");], - AC_MSG_RESULT([yes]), + AC_MSG_RESULT([yes]) + CFLAGS="$pa_add_cflags__old_cflags ifelse([$2],[],[$1],[$2])", AC_MSG_RESULT([no]) CFLAGS="$pa_add_cflags__old_cflags")]) diff --git a/configure.in b/configure.in index a4b52d0..82602c7 100644 --- a/configure.in +++ b/configure.in @@ -189,6 +189,11 @@ PA_ADD_CFLAGS([-W]) PA_ADD_CFLAGS([-Wall]) PA_ADD_CFLAGS([-std=c99]) PA_ADD_CFLAGS([-pedantic]) +dnl Suppress format warning on Windows targets due to their <inttypes.h> +PA_ADD_CFLAGS([-Wpedantic-ms-format],[-Wno-pedantic-ms-format]) +PA_ADD_CFLAGS([-Wc90-c99-compat]) +PA_ADD_CFLAGS([-Wlong-long],[-Wno-long-long]) +PA_ADD_CFLAGS([-Wwrite-strings]) AC_ARG_ENABLE([werror], [AC_HELP_STRING([--enable-werror], [compile with -Werror to error out on any warning])], |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-02-27 08:18:17
|
Commit-ID: 8d9f591005be5d9e973687af2472a8f9f6c525ae Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=8d9f591005be5d9e973687af2472a8f9f6c525ae Author: H. Peter Anvin <hp...@zy...> AuthorDate: Sat, 27 Feb 2016 00:15:13 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Sat, 27 Feb 2016 00:15:13 -0800 configure.in: add -fwrapv to gcc and compatible compilers Add the -fwrapv to gcc and compatible C compilers, to enforce deterministic 2's-complement behavior with regards to signed and unsigned integer types. Signed-off-by: H. Peter Anvin <hp...@zy...> --- configure.in | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.in b/configure.in index 6319206..01c0f07 100644 --- a/configure.in +++ b/configure.in @@ -79,6 +79,7 @@ dnl If we have gcc, add appropriate options PA_ADD_CFLAGS([-W]) PA_ADD_CFLAGS([-Wall]) PA_ADD_CFLAGS([-std=c99]) +PA_ADD_CFLAGS([-fwrapv]) dnl Look for programs... AC_CHECK_PROGS(NROFF, nroff, false) |
From: nasm-bot f. K. S. O. <bir...@an...> - 2016-02-27 07:45:37
|
Commit-ID: 52ae33a2cbcdd946c6787ebeaa066e149085a8e8 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=52ae33a2cbcdd946c6787ebeaa066e149085a8e8 Author: Knut St. Osmundsen <bir...@an...> AuthorDate: Wed, 24 Feb 2016 14:08:22 +0100 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Fri, 26 Feb 2016 23:44:10 -0800 Remove unnecessary C99 features which break Visual C++ 2010 Fixes Visual C++ 2010 breakage in recently added Codeview 8 code; these are C99 features which were not necessary to introduce. Signed-off-by: Knut St. Osmundsen <bir...@an...> Signed-off-by: H. Peter Anvin <hp...@zy...> --- md5.h | 2 +- output/codeview.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/md5.h b/md5.h index 147d3dd..ea34cda 100644 --- a/md5.h +++ b/md5.h @@ -1,7 +1,7 @@ #ifndef _MD5_H_ #define _MD5_H_ -#include <stdint.h> +#include <inttypes.h> #define MD5_HASHBYTES 16 diff --git a/output/codeview.c b/output/codeview.c index 2f5bb69..975eef9 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -59,15 +59,15 @@ static void cv8_output(int type, void *param); static void cv8_cleanup(void); struct dfmt df_cv8 = { - .fullname = "Codeview 8", - .shortname = "cv8", - .init = cv8_init, - .linenum = cv8_linenum, - .debug_deflabel = cv8_deflabel, - .debug_directive = null_debug_directive, - .debug_typevalue = cv8_typevalue, - .debug_output = cv8_output, - .cleanup = cv8_cleanup, + "Codeview 8", /* .fullname */ + "cv8", /* .shortname */ + cv8_init, /* .init */ + cv8_linenum, /* .linenum */ + cv8_deflabel, /* .debug_deflabel */ + null_debug_directive, /* .debug_directive */ + cv8_typevalue, /* .debug_typevalue */ + cv8_output, /* .debug_output */ + cv8_cleanup, /* .cleanup */ }; /******************************************************************************* |
From: nasm-bot f. K. S. O. <bir...@an...> - 2016-02-27 07:45:18
|
Commit-ID: 136c4bc73b554e2dbb6d24caf1dc412ff76a760b Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=136c4bc73b554e2dbb6d24caf1dc412ff76a760b Author: Knut St. Osmundsen <bir...@an...> AuthorDate: Wed, 24 Feb 2016 14:14:22 +0100 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Fri, 26 Feb 2016 23:44:07 -0800 doc: Remove --allow-64-bit leftover from help text. Removes help text left behind when --allow-64-bit was turned into default behavior + warning. Signed-off-by: Knut St. Osmundsen <bir...@an...> Signed-off-by: H. Peter Anvin <hp...@zy...> --- nasm.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/nasm.c b/nasm.c index a176f25..469cd51 100644 --- a/nasm.c +++ b/nasm.c @@ -805,9 +805,6 @@ static bool process_arg(char *p, char *q) "--prefix,--postfix\n" " this options prepend or append the given argument to all\n" " extern and global variables\n" - "--allow-64-bit\n" - " do not restrict 64-bit code to 64-bit capable output\n" - " formats (use with care, no complaining)\n\n" "Warnings:\n"); for (i = 0; i <= ERR_WARN_MAX; i++) printf(" %-23s %s (default %s)\n", |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-27 04:51:37
|
Commit-ID: b170a0aad5813e9e6ec22c39aa101b705d9b085f Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=b170a0aad5813e9e6ec22c39aa101b705d9b085f Author: H. Peter Anvin <hp...@li...> AuthorDate: Fri, 26 Feb 2016 20:48:52 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Fri, 26 Feb 2016 20:48:52 -0800 NASM 2.12 --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index 81c0dc3..3e162f0 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.12rc7 +2.12 |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-27 04:51:37
|
Commit-ID: a85060520a68300c7883c82178ff35eef0e0a402 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=a85060520a68300c7883c82178ff35eef0e0a402 Author: H. Peter Anvin <hp...@li...> AuthorDate: Fri, 26 Feb 2016 20:47:45 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Fri, 26 Feb 2016 20:47:45 -0800 changes.src: document Win64 build Signed-off-by: H. Peter Anvin <hp...@li...> --- doc/changes.src | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/changes.src b/doc/changes.src index 94ddb9c..c6738b9 100644 --- a/doc/changes.src +++ b/doc/changes.src @@ -40,6 +40,8 @@ since 2007. \b Line numbers in list files now correspond to the lines in the source files, instead of simply being sequential. +\b There is now an official 64-bit (x64 a.k.a. x86-64) build for Windows. + \S{cl-2.11.09} Version 2.11.09 |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-02-23 10:03:20
|
Commit-ID: 96edc04a39051ae2c36f5765af674c38363ecbc1 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=96edc04a39051ae2c36f5765af674c38363ecbc1 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Tue, 23 Feb 2016 02:01:17 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Tue, 23 Feb 2016 02:01:17 -0800 nasm.spec.in: document buildrequires properly We need asciidoc, xmlto, ghostscript, texinfo in order to be able to build the documentation. Signed-off-by: H. Peter Anvin <hp...@zy...> --- nasm.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nasm.spec.in b/nasm.spec.in index 09b1257..68126ca 100644 --- a/nasm.spec.in +++ b/nasm.spec.in @@ -10,7 +10,7 @@ Source: http://www.nasm.us/pub/nasm/releasebuilds/%{nasm_version}/nasm-%{nasm_ve URL: http://www.nasm.us/ BuildRoot: /tmp/rpm-build-nasm Prefix: %{_prefix} -BuildRequires: perl +BuildRequires: perl, asciidoc, xmlto, ghostscript, texinfo BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %package doc |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-02-23 09:09:22
|
Commit-ID: b7511971dc7e50d75d1800ddafe552b6554b37d1 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=b7511971dc7e50d75d1800ddafe552b6554b37d1 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Mon, 22 Feb 2016 01:18:33 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Mon, 22 Feb 2016 01:18:33 -0800 nasm.spec: change release to 0 to avoid distro conflicts Change the RPM release number to 0 so that distribution-produced RPMs will take precedence in all cases. Signed-off-by: H. Peter Anvin <hp...@zy...> --- nasm.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nasm.spec.in b/nasm.spec.in index dde8cec..09b1257 100644 --- a/nasm.spec.in +++ b/nasm.spec.in @@ -3,7 +3,7 @@ Summary: The Netwide Assembler, a portable x86 assembler with Intel-like syntax Name: nasm Version: @@NASM_MANGLED_VER@@ -Release: 1 +Release: 0 License: BSD Group: Development/Languages Source: http://www.nasm.us/pub/nasm/releasebuilds/%{nasm_version}/nasm-%{nasm_version}.tar.xz |