Skip to content
Snippets Groups Projects
  • Alexander V. Tikhonov's avatar
    e55396c8
    travis-ci: fix LTO and clang · e55396c8
    Alexander V. Tikhonov authored
    Made fixes:
    
    - Added CMAKE_EXTRA_PARAMS environment to docker's container
      runs to enable -DENABLE_LTO=ON/OFF cmake option.
    
    - Added CC/CXX environment to docker's container runs to set
      clang for cmake. Also the additional environment variables
      {CC,CXX}_FOR_BUILD were postponed, because we didn't
      run cross-compilation at the moment, for more info check:
    
        https://docs.travis-ci.com/user/languages/cpp/#choosing-compilers-to-test-against
    
    - Changed LTO docker's image to 'debian-buster' due to LTO needed
      higher versions of packages, check for more information commit:
    
        f9e28ce4 ('Add LTO support')
    
    - Fixed sources to avoid of failures on builds by GCC with LTO:
    
    1)  src/box/memtx_rtree.c: In function ‘mp_decode_rect’:
        src/box/memtx_rtree.c:86:24: error: ‘c’ may be used uninitialized
          in this function [-Werror=maybe-uninitialized]
            rect->coords[i * 2] = c;
                                ^
        src/box/memtx_rtree.c:74:10: note: ‘c’ was declared here
          coord_t c;
                  ^
    
    2)  src/box/sql/func.c: In function ‘quoteFunc’:
        src/box/sql/func.c:1103:3: error: ‘b’ may be used uninitialized
          in this function [-Werror=maybe-uninitialized]
           sql_result_text(context, sql_value_boolean(argv[0]) ?
           ^
        src/box/sql/vdbeapi.c:217:7: note: ‘b’ was declared here
          bool b;
               ^
    
    3)  src/box/tuple_update.c: In function ‘update_read_ops’:
        src/box/tuple_update.c:1022:4: error: ‘field_no’ may be used
          uninitialized in this function [-Werror=maybe-uninitialized]
            diag_set(ClientError, ER_NO_SUCH_FIELD_NO, field_no);
            ^
        src/box/tuple_update.c:1014:11: note: ‘field_no’ was declared here
           int32_t field_no;
                   ^
    
    4)  src/httpc.c: In function ‘httpc_set_verbose’:
        src/httpc.c:267:2: error: call to ‘_curl_easy_setopt_err_long’
          declared with attribute warning: curl_easy_setopt expects a long
          argument for this option [-Werror]
          curl_easy_setopt(req->curl_request.easy, CURLOPT_VERBOSE, curl_verbose);
          ^
    
    5)  src/lua/httpc.c: In function ‘luaT_httpc_request’:
        src/lua/httpc.c:128:64: error: ‘MEM[(int *)&parser + 20B]’ may be used
          uninitialized in this function [-Werror=maybe-uninitialized]
          lua_pushinteger(L, (parser.http_minor > 0) ? parser.http_minor: 0);
                                                                        ^
        src/lua/httpc.c:67:21: note: ‘MEM[(int *)&parser + 20B]’ was declared here
          struct http_parser parser;
                             ^
        src/lua/httpc.c:124:64: error: ‘MEM[(int *)&parser + 16B]’ may be used
          uninitialized in this function [-Werror=maybe-uninitialized]
          lua_pushinteger(L, (parser.http_major > 0) ? parser.http_major: 0);
                                                                        ^
        src/lua/httpc.c:67:21: note: ‘MEM[(int *)&parser + 16B]’ was declared here
          struct http_parser parser;
                             ^
    
    Close #4215
    travis-ci: fix LTO and clang
    Alexander V. Tikhonov authored
    Made fixes:
    
    - Added CMAKE_EXTRA_PARAMS environment to docker's container
      runs to enable -DENABLE_LTO=ON/OFF cmake option.
    
    - Added CC/CXX environment to docker's container runs to set
      clang for cmake. Also the additional environment variables
      {CC,CXX}_FOR_BUILD were postponed, because we didn't
      run cross-compilation at the moment, for more info check:
    
        https://docs.travis-ci.com/user/languages/cpp/#choosing-compilers-to-test-against
    
    - Changed LTO docker's image to 'debian-buster' due to LTO needed
      higher versions of packages, check for more information commit:
    
        f9e28ce4 ('Add LTO support')
    
    - Fixed sources to avoid of failures on builds by GCC with LTO:
    
    1)  src/box/memtx_rtree.c: In function ‘mp_decode_rect’:
        src/box/memtx_rtree.c:86:24: error: ‘c’ may be used uninitialized
          in this function [-Werror=maybe-uninitialized]
            rect->coords[i * 2] = c;
                                ^
        src/box/memtx_rtree.c:74:10: note: ‘c’ was declared here
          coord_t c;
                  ^
    
    2)  src/box/sql/func.c: In function ‘quoteFunc’:
        src/box/sql/func.c:1103:3: error: ‘b’ may be used uninitialized
          in this function [-Werror=maybe-uninitialized]
           sql_result_text(context, sql_value_boolean(argv[0]) ?
           ^
        src/box/sql/vdbeapi.c:217:7: note: ‘b’ was declared here
          bool b;
               ^
    
    3)  src/box/tuple_update.c: In function ‘update_read_ops’:
        src/box/tuple_update.c:1022:4: error: ‘field_no’ may be used
          uninitialized in this function [-Werror=maybe-uninitialized]
            diag_set(ClientError, ER_NO_SUCH_FIELD_NO, field_no);
            ^
        src/box/tuple_update.c:1014:11: note: ‘field_no’ was declared here
           int32_t field_no;
                   ^
    
    4)  src/httpc.c: In function ‘httpc_set_verbose’:
        src/httpc.c:267:2: error: call to ‘_curl_easy_setopt_err_long’
          declared with attribute warning: curl_easy_setopt expects a long
          argument for this option [-Werror]
          curl_easy_setopt(req->curl_request.easy, CURLOPT_VERBOSE, curl_verbose);
          ^
    
    5)  src/lua/httpc.c: In function ‘luaT_httpc_request’:
        src/lua/httpc.c:128:64: error: ‘MEM[(int *)&parser + 20B]’ may be used
          uninitialized in this function [-Werror=maybe-uninitialized]
          lua_pushinteger(L, (parser.http_minor > 0) ? parser.http_minor: 0);
                                                                        ^
        src/lua/httpc.c:67:21: note: ‘MEM[(int *)&parser + 20B]’ was declared here
          struct http_parser parser;
                             ^
        src/lua/httpc.c:124:64: error: ‘MEM[(int *)&parser + 16B]’ may be used
          uninitialized in this function [-Werror=maybe-uninitialized]
          lua_pushinteger(L, (parser.http_major > 0) ? parser.http_major: 0);
                                                                        ^
        src/lua/httpc.c:67:21: note: ‘MEM[(int *)&parser + 16B]’ was declared here
          struct http_parser parser;
                             ^
    
    Close #4215