]> granicus.if.org Git - esp-idf/commitdiff
Build system: Raise warning level
authorAngus Gratton <angus@espressif.com>
Wed, 16 Nov 2016 04:42:38 +0000 (15:42 +1100)
committerAngus Gratton <angus@espressif.com>
Wed, 16 Nov 2016 04:57:34 +0000 (15:57 +1100)
Default esp-idf builds now show -Wextra warnings (except for a few:
signed/unsigned comparison, unused parameters, old-style C declarations.)

CI building of examples runs with that level raised to -Werror, to catch
those changes going into the main repo.

components/bootloader_support/src/esp_image_format.c
components/bootloader_support/src/secure_boot_signatures.c
components/expat/port/minicheck.c
components/freertos/ringbuf.c
components/freertos/tasks.c
make/build_examples.sh
make/project.mk

index 42a3e4ffe2f231010bbe032390050af57432bcb3..ca75f6ae4597ca0e71f783c099ce80b41c9784d8 100644 (file)
@@ -17,7 +17,7 @@
 #include <esp_log.h>
 #include <bootloader_flash.h>
 
-const static char *TAG = "esp_image";
+static const char *TAG = "esp_image";
 
 #define SIXTEEN_MB 0x1000000
 #define ESP_ROM_CHECKSUM_INITIAL 0xEF
index 6d47651b2f8fd911f89d3254158d035a0476a816..f7e435e86d873081e4b883e681814032d51e9f12 100644 (file)
@@ -45,10 +45,13 @@ esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
     sha_context sha;
     uint8_t digest[32];
     ptrdiff_t keylen;
-    const uint8_t *data, *digest_data;
-    uint32_t digest_len;
+    const uint8_t *data;
     const signature_block_t *sigblock;
     bool is_valid;
+#ifdef BOOTLOADER_BUILD
+    const uint8_t *digest_data;
+    uint32_t digest_len;
+#endif
 
     ESP_LOGD(TAG, "verifying signature src_addr 0x%x length 0x%x", src_addr, length);
 
index 5a1f5ed0e252e94e5f6b81f519ab7e15c9c915b3..95a4939bdb38e032311bdd3e7d42c2fb57916268 100644 (file)
@@ -108,44 +108,45 @@ add_failure(SRunner *runner, int verbosity)
     }
 }
 
+static void run_test(SRunner *runner, int verbosity, TCase *tc, int i)
+{
+  if (tc->setup != NULL) {
+    /* setup */
+    if (setjmp(env)) {
+      add_failure(runner, verbosity);
+      return;
+    }
+    tc->setup();
+  }
+  /* test */
+  if (setjmp(env)) {
+    add_failure(runner, verbosity);
+    return;
+  }
+  (tc->tests[i])();
+
+  /* teardown */
+  if (tc->teardown != NULL) {
+    if (setjmp(env)) {
+      add_failure(runner, verbosity);
+      return;
+    }
+    tc->teardown();
+  }
+}
+
 void
 srunner_run_all(SRunner *runner, int verbosity)
 {
-    Suite *suite;
-    TCase *tc;
     assert(runner != NULL);
-    suite = runner->suite;
-    tc = suite->tests;
+    assert(runner->suite != NULL);
+    TCase *tc = runner->suite->tests;
     while (tc != NULL) {
-        int i;
-        for (i = 0; i < tc->ntests; ++i) {
+        for (int i = 0; i < tc->ntests; ++i) {
             runner->nchecks++;
-
-            if (tc->setup != NULL) {
-                /* setup */
-                if (setjmp(env)) {
-                    add_failure(runner, verbosity);
-                    continue;
-                }
-                tc->setup();
-            }
-            /* test */
-            if (setjmp(env)) {
-                add_failure(runner, verbosity);
-                continue;
-            }
-            (tc->tests[i])();
-
-            /* teardown */
-            if (tc->teardown != NULL) {
-                if (setjmp(env)) {
-                    add_failure(runner, verbosity);
-                    continue;
-                }
-                tc->teardown();
-            }
+            run_test(runner, verbosity, tc, i);
+            tc = tc->next_tcase;
         }
-        tc = tc->next_tcase;
     }
     if (verbosity) {
         int passed = runner->nchecks - runner->nfailures;
index a4205d88dc0e76930cce520c2711784cd327091d..062c52023fc7610b91e3bdbda1740ec8ddb00689 100644 (file)
@@ -495,8 +495,8 @@ BaseType_t xRingbufferSend(RingbufHandle_t ringbuf, void *data, size_t dataSize,
                 //we will need to wait some more.
                 ticks_to_wait = ticks_end - xTaskGetTickCount();
             }
-        } while (ringbufferFreeMem(rb) < needed_size && ticks_to_wait>=0);
-        
+        } while (ringbufferFreeMem(rb) < needed_size && ticks_end >= xTaskGetTickCount());
+
         //Lock the mux in order to make sure no one else is messing with the ringbuffer and do the copy.
         portENTER_CRITICAL(&rb->mux);
         //Another thread may have been able to sneak its write first. Check again now we locked the ringbuff, and retry
index 88aa8d3ef5dd7236defe6e1d416f1ea24b8326fe..26103ee2364b8341c2317f64c0f0d438fba5d7fd 100644 (file)
@@ -2704,7 +2704,7 @@ void vTaskSwitchContext( void )
                taskENTER_CRITICAL_ISR(&xTaskQueueMutex);
                
                unsigned portBASE_TYPE foundNonExecutingWaiter = pdFALSE, ableToSchedule = pdFALSE, resetListHead;
-               unsigned portBASE_TYPE uxDynamicTopReady = uxTopReadyPriority;
+               portBASE_TYPE uxDynamicTopReady = uxTopReadyPriority;
                unsigned portBASE_TYPE holdTop=pdFALSE;
                
                /*
@@ -2717,8 +2717,6 @@ void vTaskSwitchContext( void )
                
                while ( ableToSchedule == pdFALSE && uxDynamicTopReady >= 0 )
                {
-                       configASSERT( uxTopReadyPriority>=0 );
-                       configASSERT( uxDynamicTopReady>=0 );
                        resetListHead = pdFALSE;
                        // Nothing to do for empty lists
                        if (!listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxDynamicTopReady ] ) )) {
index a522666a98219eb12bd9c31c744bd1b376105f18..8345dab50200c78692e24ecf9ba171e26d343b7e 100755 (executable)
@@ -20,8 +20,13 @@ for example in ${IDF_PATH}/examples/*; do
     mkdir ${EXAMPLE_NUM}
     cp -r ${example} ${EXAMPLE_NUM}
     pushd ${EXAMPLE_NUM}/`basename ${example}`
-    # build non-verbose first, only build verbose if there's an error
-    make defconfig all || (RESULT=$?; make V=1)
+
+   # be stricter in the CI build than the default IDF settings
+   export EXTRA_CFLAGS="-Werror -Werror=deprecated-declarations"
+   export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
+
+   # build non-verbose first, only build verbose if there's an error
+    (make clean defconfig && make all ) || (RESULT=$?; make V=1)
     popd
     EXAMPLE_NUM=$(( $EXAMPLE_NUM + 1 ))
 done
index 08c7dd89a95cea8dc05669d188ff16d2db869831..a081992804fe5466bc8e1e2e6c18175b676ca606 100644 (file)
@@ -158,14 +158,16 @@ LDFLAGS ?= -nostdlib \
 
 # CPPFLAGS used by C preprocessor
 # If any flags are defined in application Makefile, add them at the end. 
-CPPFLAGS := -DESP_PLATFORM $(CPPFLAGS)
+CPPFLAGS := -DESP_PLATFORM $(CPPFLAGS) $(EXTRA_CPPFLAGS)
 
 # Warnings-related flags relevant both for C and C++
-COMMON_WARNING_FLAGS = -Wall -Werror \
+COMMON_WARNING_FLAGS = -Wall -Werror=all \
        -Wno-error=unused-function \
        -Wno-error=unused-but-set-variable \
        -Wno-error=unused-variable \
-       -Wno-error=deprecated-declarations
+       -Wno-error=deprecated-declarations \
+       -Wextra \
+       -Wno-unused-parameter -Wno-sign-compare
 
 # Flags which control code generation and dependency generation, both for C and C++
 COMMON_FLAGS = \
@@ -192,8 +194,9 @@ CFLAGS := $(strip \
        -std=gnu99 \
        $(OPTIMIZATION_FLAGS) \
        $(COMMON_FLAGS) \
-       $(COMMON_WARNING_FLAGS) \
-       $(CFLAGS))
+       $(COMMON_WARNING_FLAGS) -Wno-old-style-declaration \
+       $(CFLAGS) \
+       $(EXTRA_CFLAGS))
 
 # List of flags to pass to C++ compiler
 # If any flags are defined in application Makefile, add them at the end.
@@ -204,7 +207,8 @@ CXXFLAGS := $(strip \
        $(OPTIMIZATION_FLAGS) \
        $(COMMON_FLAGS) \
        $(COMMON_WARNING_FLAGS) \
-       $(CXXFLAGS))
+       $(CXXFLAGS) \
+       $(EXTRA_CXXFLAGS))
 
 export CFLAGS CPPFLAGS CXXFLAGS