Skip to content

Fix #12172:False positive: misra-11.1 function pointer assigned to array#5667

Merged
danmar merged 1 commit intocppcheck-opensource:mainfrom
swasti16:swasti/12172_11.1
Nov 16, 2023
Merged

Fix #12172:False positive: misra-11.1 function pointer assigned to array#5667
danmar merged 1 commit intocppcheck-opensource:mainfrom
swasti16:swasti/12172_11.1

Conversation

@swasti16
Copy link
Copy Markdown
Contributor

No description provided.

Comment thread addons/test/misra/misra-test.c Outdated
void *misra_11_1_bad1 = (void*)misra_11_1_p; // 11.1 8.4

// #12172
typedef void (*pfFunc)(uint32_t some);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's unfortunate to write such generic type/variable names in the global scope in this misra-test.c. There are lots of variables, types and functions and we don't want to have any duplicates. Did you check in the whole file that there is no other function f or global array data. Next time you need to add an array or function what will you call it instead of data or f.

ensure that they are more unique.

I have used the convention to append _11_1 for names in global scope that apply to testing of rule 11.1. So please follow that convention. pfFunc_11_1 , data_11_1 and f_11_1

@danmar danmar merged commit 1ce9013 into cppcheck-opensource:main Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants