[IOT-2268] cleanup unused-local-typedefs warning 13/22213/2
authorGeorge Nash <george.nash@intel.com>
Tue, 25 Jul 2017 16:38:19 +0000 (09:38 -0700)
committerRick Bell <richard.s.bell@intel.com>
Mon, 18 Sep 2017 17:39:17 +0000 (17:39 +0000)
commitc999eae32065a04a73d7a51290709486ed703967
tree5d75a7b9d0728f06254d62d2b64bfe82297032aa
parent7c0aa196aaa1236b3b351a8fb7a06f73028156ad
[IOT-2268] cleanup unused-local-typedefs warning

The definition used for the OC_STATIC_ASSERT created
an unused typedef with an array of an invalid size
if the assert condition was not met. This resulted
in an unused-local-typedef warning every time
OC_STATIC_ASSERT was used even if it did not cause
a static assert.

The macro was updated to create an enum of 1/condition
if the condition is false this will create a compiler
warning because 1/0 is an invalid value. Its supprisingly
difficult to find a macro that will satisfy C, and C++
for most standard compilers. With out producing a warning.

Also when possible the __COUNTER__ macro is used to create
the unique identifier for the OC_STATIC_ASSERT this
addresses the problem of using the static ASSERT on the
same line. This would have been an issue with the original
way the code was written.

Bug: https://jira.iotivity.org/browse/IOT-2268
Bug: https://jira.iotivity.org/browse/IOT-2539
Change-Id: I4a9cc8d61702eacaddfd1ae5679126af02208f5e
Signed-off-by: George Nash <george.nash@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21619
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Rick Bell <richard.s.bell@intel.com>
(cherry picked from commit db426b113862fddd2241029dd8f7ee4bed01e39a)
resource/c_common/platform_features.h