diff options
author | Erwin Jansen <jansene@google.com> | 2020-01-14 21:15:38 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2020-01-14 21:15:38 +0000 |
commit | 8cf7b38509b134a3bbc734cccdffcf91db88f03b (patch) | |
tree | d07818ef4e37bd4c152c64e66ee6c8bbf2df62be | |
parent | 03f32b6d95feeba63d1c219ce085c77435d352ec (diff) | |
parent | 89852ee952026eb992019036ac90e5ebe90aaf09 (diff) | |
download | patched-yasm-emu-master-dev.tar.gz |
Merge "Fix a series of compiler warnings" into emu-master-devemu-master-dev
-rw-r--r-- | CMakeLists.txt | 89 | ||||
-rw-r--r-- | libyasm/expr.c | 8 | ||||
-rw-r--r-- | libyasm/expr.h | 2 | ||||
-rw-r--r-- | tools/re2c/code.c | 2 | ||||
-rwxr-xr-x | tools/re2c/mbo_getopt.c | 2 | ||||
-rw-r--r-- | tools/re2c/translate.c | 2 |
6 files changed, 54 insertions, 51 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 41a1e69..7943e58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,53 +1,56 @@ -PROJECT(yasm) -CMAKE_MINIMUM_REQUIRED(VERSION 2.4) -if (COMMAND cmake_policy) - cmake_policy(SET CMP0003 NEW) -endif (COMMAND cmake_policy) - - -# Clear out C Flags for this project, as our parent project has -# settings that will cause a lot of issues, clang finds a lot of issues -# so we will disable all erorrs. -SET(CMAKE_C_FLAGS "-O2 -Wno-all") -OPTION(BUILD_SHARED_LIBS "Build shared libraries" OFF) -OPTION(ENABLE_NLS "Enable message translations" OFF) -OPTION(YASM_BUILD_TESTS "Enable building of tests" ON) -OPTION(YASM_INSTALL "Enable install" OFF) - -IF(YASM_BUILD_TESTS) - ENABLE_TESTING() -ENDIF(YASM_BUILD_TESTS) - +project(yasm) +cmake_minimum_required(VERSION 2.4) +if(COMMAND cmake_policy) + cmake_policy(SET CMP0003 NEW) +endif(COMMAND cmake_policy) + +# Clear out C Flags for this project, as our parent project has settings that +# will cause a lot of issues, clang finds a lot of issues so we will disable all +# erorrs. +set(CMAKE_C_FLAGS + "-O0 -Wall -Wno-format-nonliteral -Wno-implicit-int-conversion -Wno-unused-function -Wno-unreachable-code-return -Wno-undef -Wno-shorten-64-to-32 -Wno-unused-parameter -Wno-documentation-unknown-command -Wno-sign-conversion -Wno-covered-switch-default -Wno-switch -Wno-extra-semi-stmt -Wno-unreachable-code-break -Wno-cast-align -Wno-switch-enum -Wno-documentation -Wno-unused-macros -Wno-unreachable-code-break" +) +option(BUILD_SHARED_LIBS "Build shared libraries" OFF) +option(ENABLE_NLS "Enable message translations" OFF) +option(YASM_BUILD_TESTS "Enable building of tests" ON) +option(YASM_INSTALL "Enable install" OFF) + +if(YASM_BUILD_TESTS) + enable_testing() +endif(YASM_BUILD_TESTS) + +if(UNIX) + add_definitions("-DHAVE_UNISTD_H") +endif() # Where to look first for cmake modules list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules") -INCLUDE(YasmMacros) -INCLUDE(VersionGen) - +include(YasmMacros) +include(VersionGen) -# Default build type to release if not set -IF(NOT CMAKE_BUILD_TYPE) - SET(CMAKE_BUILD_TYPE Release CACHE STRING - "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." - FORCE) -ENDIF(NOT CMAKE_BUILD_TYPE) +# Default build type to debug if not set. +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE + Debug + CACHE + STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) +endif(NOT CMAKE_BUILD_TYPE) -VERSION_GEN(PACKAGE_VERSION "${CMAKE_BINARY_DIR}/YASM-VERSION-FILE" "1.3.0") +version_gen(PACKAGE_VERSION "${CMAKE_BINARY_DIR}/YASM-VERSION-FILE" "1.3.0") -set (PACKAGE_STRING "yasm ${PACKAGE_VERSION}") +set(PACKAGE_STRING "yasm ${PACKAGE_VERSION}") -INCLUDE_DIRECTORIES(AFTER ${CMAKE_CURRENT_BINARY_DIR} ${yasm_SOURCE_DIR}) +include_directories(AFTER ${CMAKE_CURRENT_BINARY_DIR} ${yasm_SOURCE_DIR}) -INCLUDE(ConfigureChecks.cmake) +include(ConfigureChecks.cmake) -ADD_SUBDIRECTORY(tools) -ADD_SUBDIRECTORY(libyasm) -ADD_SUBDIRECTORY(modules) -ADD_SUBDIRECTORY(frontends) +add_subdirectory(tools) +add_subdirectory(libyasm) +add_subdirectory(modules) +add_subdirectory(frontends) -if (YASM_INSTALL) - INSTALL(FILES - libyasm.h - ${CMAKE_BINARY_DIR}/libyasm-stdint.h - DESTINATION include - ) +if(YASM_INSTALL) + install(FILES libyasm.h ${CMAKE_BINARY_DIR}/libyasm-stdint.h + DESTINATION include) endif() diff --git a/libyasm/expr.c b/libyasm/expr.c index 1aad79d..9cc027e 100644 --- a/libyasm/expr.c +++ b/libyasm/expr.c @@ -222,8 +222,8 @@ expr_xform_bc_dist_base(/*@returned@*/ /*@only@*/ yasm_expr *e, yasm_expr *sube; yasm_intnum *intn; yasm_symrec *sym = NULL; - /*@dependent@*/ yasm_section *sect2; - /*@dependent@*/ /*@null@*/ yasm_bytecode *precbc2; + /*@dependent@*/ yasm_section *sect2 = NULL; + /*@dependent@*/ /*@null@*/ yasm_bytecode *precbc2 = NULL; /* First look for an (-1*symrec) term */ if (e->terms[i].type != YASM_EXPR_EXPR) @@ -913,7 +913,7 @@ expr_lift_segoff(yasm_expr *e, int calc_bc_dist) { yasm_expr *retval = NULL; int i; - + if (e->op < YASM_EXPR_LOGIC || e->op == YASM_EXPR_SEGOFF) { i = e->op == YASM_EXPR_SEGOFF ? 1 : 0; for (; i<e->numterms; i++) { @@ -1108,7 +1108,7 @@ yasm_expr__copy_except(const yasm_expr *e, int except) { yasm_expr *n; int i; - + n = yasm_xmalloc(sizeof(yasm_expr) + sizeof(yasm_expr__item)*(e->numterms<2?0:e->numterms-2)); diff --git a/libyasm/expr.h b/libyasm/expr.h index 0de62df..e54cfe8 100644 --- a/libyasm/expr.h +++ b/libyasm/expr.h @@ -76,7 +76,7 @@ struct yasm_expr { * terms, as some operations may allow more than two operand terms * (ADD, MUL, OR, AND, XOR). */ - yasm_expr__item terms[2]; + yasm_expr__item terms[3]; }; /** Create a new expression e=a op b. diff --git a/tools/re2c/code.c b/tools/re2c/code.c index 92e24d5..46ce0ed 100644 --- a/tools/re2c/code.c +++ b/tools/re2c/code.c @@ -1,5 +1,5 @@ #ifdef _WIN32 -#include <windows.h> +#include <Windows.h> #include <io.h> #endif #include <stdlib.h> diff --git a/tools/re2c/mbo_getopt.c b/tools/re2c/mbo_getopt.c index f4553dc..47d3822 100755 --- a/tools/re2c/mbo_getopt.c +++ b/tools/re2c/mbo_getopt.c @@ -94,7 +94,7 @@ int mbo_getopt(int argc, char* const *argv, const mbo_opt_struct opts[], char ** optchr = 0; dash = 1; - arg_start = 2 + strlen(opts[opts_idx].opt_name); + arg_start = 2 + (int) strlen(opts[opts_idx].opt_name); } if (!dash) diff --git a/tools/re2c/translate.c b/tools/re2c/translate.c index 7ba173e..e343402 100644 --- a/tools/re2c/translate.c +++ b/tools/re2c/translate.c @@ -1,6 +1,6 @@ #include "tools/re2c/globals.h" -unsigned char asc2asc[256] = { +static unsigned char asc2asc[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, |