fix gcc compiling warning info for Smbios 3.3.0#43
Merged
lian-bo merged 16 commits intonima:smbios-3.3.0from Oct 24, 2022
Merged
fix gcc compiling warning info for Smbios 3.3.0#43lian-bo merged 16 commits intonima:smbios-3.3.0from
lian-bo merged 16 commits intonima:smbios-3.3.0from
Conversation
src/dmidecodemodule.c:154:27: Warning argument 1 null where non-null expected [-Wnonnull]
154 | } else if(memcmp(buf, "_SM_", 4) == 0) {
| ^~~~~~~~~~~~~~~~~~~~~~
src/dmidecodemodule.c:158:27: Warning argument 1 null where non-null expected [-Wnonnull]
158 | } else if(memcmp(buf, "_DMI_", 5) == 0) {
| ^~~~~~~~~~~~~~~~~~~~~~~
src/dmidump.c:157:1:warning: ignoring return value of 'legacy_decode' [-Wreturn-type]
157 | }
| ^
src/util.c:225:76: warning: comparison of integer expressions of different signedness: 'long unsigned int' and '__off_t' {aka 'long int'} [-Wsign-compare]
225 | if (sigill_error || S_ISREG(statbuf.st_mode) && base + (off_t)len > statbuf.st_size )
| ^
src/util.c:225:55: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
225 | if (sigill_error || S_ISREG(statbuf.st_mode) && base + (off_t)len > statbuf.st_size )
|
src/util.c:225:55: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
225 | if (sigill_error || S_ISREG(statbuf.st_mode) && (__off_t)(base + (off_t)len) > statbuf.st_size )
|
src/efi.c:52:21: warning: variable 'eptype' set but not used [-Wunused-but-set-variable]
52 | const char *eptype;
|
src/dmidecode.c:6274:21: warning: unused variable 'ver' [-Wunused-variable]
6274 | u32 ver = (buf[0x07] << 16) + (buf[0x08] << 8) + buf[0x09];
| ^~~
… pointer type
src/dmidecode.c:5248:60: warning: passing argument 3 of 'dmi_slot_peers' from incompatible pointer type [-Wincompatible-pointer-types]
5248 | dmi_slot_peers(sect_n, data[0x12], h, data+0x13);
| ^
| |
| struct dmi_header *
src/dmidecode.c:2471:52: note: expected 'const u8 *' {aka 'const unsigned char *'} but argument is of type 'struct dmi_header *'
2471 | void dmi_slot_peers(xmlNode *node, u8 n, const u8 *data, struct dmi_header *h)
| ~~~~~~~~~~^~~~
src/dmidecode.c:5248:67: warning: passing argument 4 of 'dmi_slot_peers' from incompatible pointer type [-Wincompatible-pointer-types]
5248 | dmi_slot_peers(sect_n, data[0x12], h, data+0x13);
| ~~~~^~~~~
| |
| const u8 * {aka const unsigned char *}
src/dmidecode.c:2471:77: note: expected 'struct dmi_header *' but argument is of type 'const u8 *' {aka 'const unsigned char *'}
2471 | void dmi_slot_peers(xmlNode *node, u8 n, const u8 *data, struct dmi_header *h)
….c:4788:24: warning: 'return' with a value, in function returning void [-Wreturn-type] 4788 | return data_n; | ^~~~~~
src/dmidecodemodule.c:350:12: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
350 | if(buf = mem_chunk(opt->logdata, fp, 0x20, opt->devmem) == NULL ){
| ^~~
src/dmidecodemodule.c:206:12: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
206 | if(buf = mem_chunk(opt->logdata, fp, 0x20, opt->devmem) == NULL){
| ^~~
src/dmidecode.c:4446:21: warning: unused variable 'addrstr' [-Wunused-variable]
4446 | const char *addrstr;
| ^~~~~~~
src/dmidecode.c: In function 'dmi_parse_protocol_record':
src/dmidecode.c:4448:14: warning: unused variable 'attr' [-Wunused-variable]
4448 | char attr[38];
| ^~~~
…from integer without a cast
src/dmidecode.c: In function 'dmi_decode':
src/dmidecode.c:6032:47: warning: passing argument 2 of 'dmi_tpm_vendor_id' makes pointer from integer without a cast [-Wint-conversion]
6032 | dmi_tpm_vendor_id(sect_n, data[0x04]);
| ~~~~^~~~~~
| |
| u8 {aka unsigned char}
src/dmidecode.c: In function 'dmi_additional_info':
src/dmidecode.c:4262:42: warning: variable 'str_n' set but not used [-Wunused-but-set-variable]
4262 | xmlNode *data_n = NULL, *str_n = NULL, *val_n = NULL;
| ^~~~~
src/dmidecodemodule.c: In function 'dmidecode_get_xml':
src/dmidecodemodule.c:394:25: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
394 | if(legacy_decode(opt->logdata, opt->type,
| ^~
src/dmidecodemodule.c:397:33: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
397 | goto done;
| ^~~~
Merge pull request nima#42 from HuO50/smbios-3.3.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi , Everyone,
I have fixed the gcc warning problems in my code, and trying to solve warnings old code has. These fix warning patch also adjust some codes. Most warning caused by variables in dmidecode not used in python-dmidecode may cause warning. I have fixed them after testing to make sure them will not cause bad influence.
@lian-bo @lichliu , please test these patches if nesscery.