Project

General

Profile

Bug #13805

Updated by Toomas Soome 9 months ago

Build errors with gcc compilers: 
 <pre> 
     nwamcfg.c: In function 'do_commit': 
     nwamcfg.c:1209:6: error: 'verr' may be used uninitialized in this function [-Werror=maybe-uninitialized] 
      1209 |     if (verr != NWAM_SUCCESS) 
           |        ^ 
     nwamcfg.c: In function 'show_prop_test': 
     nwamcfg.c:2350:6: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] 
      2350 |     if (ret != NWAM_SUCCESS) 
           |        ^ 
     nwamcfg.c: In function 'is_prop_multivalued': 
     nwamcfg.c:2487:5: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] 
      2487 |    if (ret != NWAM_SUCCESS) 
           |       ^ 
     nwamcfg.c: In function 'prop_value_type': 
     nwamcfg.c:1993:5: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] 
      1993 |    if (ret != NWAM_SUCCESS) 
           |       ^ 
     nwamcfg.c: In function 'str_to_nwam_value': 
     nwamcfg.c:2137:3: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] 
      2137 |     nwamerr(ret, "Failed creating nwam_value"); 
           |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     nwamcfg.c:2113:20: error: 'boolean_vals' may be used uninitialized in this function [-Werror=maybe-uninitialized] 
      2113 |      boolean_vals[i] = str_to_boolean(val[i]); 
           |      ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ 
     nwamcfg.c:2096:18: error: 'uint_vals' may be used uninitialized in this function [-Werror=maybe-uninitialized] 
      2096 |       uint_vals[i] = str_as_enum; 
           |       ~~~~~~~~~~~~~^~~~~~~~~~~~~ 
     nwamcfg.c:2080:16: error: 'int_vals' may be used uninitialized in this function [-Werror=maybe-uninitialized] 
      2080 |      int_vals[i] = (int64_t)atoi(val[i]); 
           |      ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ 
     nwamcfg.c: In function 'output_prop_val': 
     nwamcfg.c:2790:10: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized] 
      2790 |     (void) fprintf(wf, "%s%s", tostr(val, prop_name, str), 
           |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      2791 |         i != num-1 ? NWAM_VALUE_DELIMITER_STR : ""); 
           |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     nwamcfg.c:2790:10: error: 'tostr' may be used uninitialized in this function [-Werror=maybe-uninitialized] 
     nwamcfg.c: In function 'destroy_func': 
     nwamcfg.c:1685:12: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] 
      1685 |    } else if (ret != NWAM_SUCCESS) { 
           |              ^ 
     nwamcfg.c: In function 'revert_func': 
     nwamcfg.c:1833:4: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] 
      1833 |      nwamerr(ret, "Revert error"); 
           |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     nwamcfg.c: In function 'clear_func': 
     nwamcfg.c:3864:38: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] 
      3864 |     if (ret == NWAM_INVALID_ARG || ret == NWAM_ENTITY_NOT_FOUND) { 
           |                                    ~~~~^~~~~~~~~~~~~~~~~~~~~~~~ 
     nwamcfg.c: In function 'verify_func': 
     nwamcfg.c:4161:3: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] 
      4161 |     nwamerr(ret, "Verify error on property '%s'", errprop); 
           |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     cc1: all warnings being treated as errors 
    
     nwamcfg.c: In function 'cmd_file': 
     nwamcfg.c:4287:3: error: 'infile' may be used uninitialized in this function [-Werror=maybe-uninitialized] 
        (void) fclose(infile); 
        ^~~~~~~~~~~~~~~~~~~~~ 
     cc1: all warnings being treated as errors 
     *** Error code 1 
     dmake: Fatal error: Command failed for target `nwamcfg.o' 
     Current working directory /code/illumos-gate/usr/src/cmd/cmd-inet/usr.sbin/nwamcfg 
 </pre> 

 Testing done: build/install/boot

Back