summaryrefslogtreecommitdiff
path: root/src/ilasm
diff options
context:
space:
mode:
Diffstat (limited to 'src/ilasm')
-rw-r--r--src/ilasm/CMakeLists.txt11
-rw-r--r--src/ilasm/assembler.cpp2
-rw-r--r--src/ilasm/main.cpp2
-rw-r--r--src/ilasm/prebuilt/asmparse.cpp (renamed from src/ilasm/prebuilt/asmparse.c)2
4 files changed, 8 insertions, 9 deletions
diff --git a/src/ilasm/CMakeLists.txt b/src/ilasm/CMakeLists.txt
index 34ec7997c4..9e99d02bb2 100644
--- a/src/ilasm/CMakeLists.txt
+++ b/src/ilasm/CMakeLists.txt
@@ -22,25 +22,23 @@ set(ILASM_SOURCES
asmman.cpp
main.cpp
assembler.cpp
- prebuilt/asmparse.c
+ prebuilt/asmparse.cpp
)
if(WIN32)
set(ILASM_RESOURCES Native.rc)
add_definitions(-DFX_VER_INTERNALNAME_STR=ilasm.exe)
endif(WIN32)
-set_source_files_properties( prebuilt/asmparse.c PROPERTIES LANGUAGE CXX )
if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-x c++)
- # Need generate a right form of asmparse.c to avoid the following options.
+ # Need generate a right form of asmparse.cpp to avoid the following options.
# Clang also produces a bad-codegen on this prebuilt file with optimization.
# https://github.com/dotnet/coreclr/issues/2305
add_compile_options(-Wno-delete-non-virtual-dtor)
add_compile_options(-Wno-deprecated-register)
add_compile_options(-Wno-array-bounds)
add_compile_options(-Wno-unused-label)
- set_source_files_properties( prebuilt/asmparse.c PROPERTIES COMPILE_FLAGS -O0 )
+ set_source_files_properties( prebuilt/asmparse.cpp PROPERTIES COMPILE_FLAGS "-O0" )
endif(CLR_CMAKE_PLATFORM_UNIX)
_add_executable(ilasm
@@ -82,4 +80,5 @@ else()
)
endif(CLR_CMAKE_PLATFORM_UNIX)
-install_clr(ilasm) \ No newline at end of file
+install_clr(ilasm)
+
diff --git a/src/ilasm/assembler.cpp b/src/ilasm/assembler.cpp
index 690da64890..49d4ee9712 100644
--- a/src/ilasm/assembler.cpp
+++ b/src/ilasm/assembler.cpp
@@ -1725,7 +1725,7 @@ void Assembler::EmitInstrBrOffset(Instr* instr, int offset)
unsigned opc=instr->opcode;
if(m_fOptimize)
{
- if((-128 >= offset)&&(offset <= 127))
+ if((-128 <= offset)&&(offset <= 127))
{
opc = instr->opcode = ShortOf(opc);
}
diff --git a/src/ilasm/main.cpp b/src/ilasm/main.cpp
index 811c65640e..2bef40dd47 100644
--- a/src/ilasm/main.cpp
+++ b/src/ilasm/main.cpp
@@ -768,7 +768,7 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv)
for(iFile = 0; iFile < NumDeltaFiles; iFile++)
{
wcscpy_s(wzNewOutputFilename,MAX_FILENAME_LENGTH+16,wzOutputFilename);
- exitval = (int)StringCchPrintfW(&wzNewOutputFilename[wcslen(wzNewOutputFilename)], 32,
+ exitval = _snwprintf_s(&wzNewOutputFilename[wcslen(wzNewOutputFilename)], 32, _TRUNCATE,
W(".%d"),iFile+1);
MakeProperSourceFileName(pwzDeltaFiles[iFile], uCodePage, wzInputFilename, szInputFilename);
if(pAsm->m_fReportProgress)
diff --git a/src/ilasm/prebuilt/asmparse.c b/src/ilasm/prebuilt/asmparse.cpp
index 71b31a5ed6..50c62030ff 100644
--- a/src/ilasm/prebuilt/asmparse.c
+++ b/src/ilasm/prebuilt/asmparse.cpp
@@ -1744,7 +1744,7 @@ YYSTATIC YYCONST short yyrecover[] = {
#define YYAPI_TOKENTYPE int
#define YYAPI_TOKENEME(t) (t)
#define YYAPI_TOKENNONE -1
-#define YYAPI_TOKENSTR(t) (sprintf(yytokbuf, "%d", t), yytokbuf)
+#define YYAPI_TOKENSTR(t) (sprintf_s(yytokbuf, _countof(yytokbuf), "%d", t), yytokbuf)
#define YYAPI_VALUENAME yylval
#define YYAPI_VALUETYPE YYSTYPE
#define YYAPI_VALUEOF(v) (v)