ccollins476ad closed pull request #1164: sys/stats - Add macro for reading stat 
value
URL: https://github.com/apache/mynewt-core/pull/1164
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/kernel/os/test/src/sem_test.c b/kernel/os/test/src/sem_test.c
index 457affd1df..90cac09642 100644
--- a/kernel/os/test/src/sem_test.c
+++ b/kernel/os/test/src/sem_test.c
@@ -117,6 +117,11 @@ sem_test_basic_handler(void *arg)
     struct os_sem *sem;
     os_error_t err;
 
+    /* Prevent unused-but-set-variable warning when system assert is
+     * enabled.
+     */
+    (void)t;
+
     sem = &g_sem1;
     t = os_sched_get_current_task();
 
diff --git a/sys/stats/full/include/stats/stats.h 
b/sys/stats/full/include/stats/stats.h
index b6a876c637..1763b6ab8e 100644
--- a/sys/stats/full/include/stats/stats.h
+++ b/sys/stats/full/include/stats/stats.h
@@ -74,14 +74,17 @@ STATS_SECT_DECL(__name) {                   \
     (__size),                                                               \
     ((sizeof (__sectvarname)) - sizeof (struct stats_hdr)) / (__size)
 
+#define STATS_GET(__sectvarname, __var)        \
+    ((__sectvarname).STATS_SECT_VAR(__var))
+
 #define STATS_INC(__sectvarname, __var)        \
-    ((__sectvarname).STATS_SECT_VAR(__var)++)
+    (STATS_GET(__sectvarname, __var)++)
 
 #define STATS_INCN(__sectvarname, __var, __n)  \
-    ((__sectvarname).STATS_SECT_VAR(__var) += (__n))
+    (STATS_GET(__sectvarname, __var) += (__n))
 
 #define STATS_CLEAR(__sectvarname, __var)        \
-    ((__sectvarname).STATS_SECT_VAR(__var) = 0)
+    (STATS_GET(__sectvarname, __var) = 0)
 
 #if MYNEWT_VAL(STATS_NAMES)
 
diff --git a/sys/stats/stub/include/stats/stats.h 
b/sys/stats/stub/include/stats/stats.h
index af6603b5ea..f91a63e294 100644
--- a/sys/stats/stub/include/stats/stats.h
+++ b/sys/stats/stub/include/stats/stats.h
@@ -61,6 +61,7 @@ struct stats_hdr {
 
 #define STATS_SIZE_INIT_PARMS(__sectvarname, __size) 0, 0
 
+#define STATS_GET(__sectvarname, __var)
 #define STATS_INC(__sectvarname, __var)
 #define STATS_INCN(__sectvarname, __var, __n)
 #define STATS_CLEAR(__sectvarname, __var)


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to