> In this case, the warning is probably bogus (I'll have to check the > scan-build output but having problems logging in to jenkins). Unfortunately, > the fix is, too. There's no point in adding an assert to check for the value > of a variable when that value has no possible bearing on the program (the > variable is never used after the assert, which, incidentally, was exactly > what scan-build complained about).
I think the correct fix here is to split the fn. The assert() I added amounts to a post-condition of the fn I want to split out. To split out the fn, I need a bigger monitor than I have now, or a re-factoring tool. assert()'s are designed to be used for pre and post conditions. OpenOCD certainly does not suffer from over-usage of asserts. If we ignore what clang is complaining about, then I think we can agree that clang found a function that is too big and complex. Once this fn has been split in two, then copy and paste code can be avoided more easily for ir/drscan versions of the same command. clang is new to me, so I'm still learning to interpret it's warnings into sensible refactorings. -- Øyvind Harboe - Can Zylin Consulting help on your project? US toll free 1-866-980-3434 http://www.zylin.com/ _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development