From 25c0843f6378fecb876d4125d6c9395ec2663d1f Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Sun, 20 Feb 2022 18:15:11 +0300 Subject: [PATCH 1/3] take note of compilation warnings --- doc/faq/a02-my-esp-crashes.rst | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/doc/faq/a02-my-esp-crashes.rst b/doc/faq/a02-my-esp-crashes.rst index a000bd0f79..fe3135315d 100644 --- a/doc/faq/a02-my-esp-crashes.rst +++ b/doc/faq/a02-my-esp-crashes.rst @@ -6,6 +6,7 @@ My ESP crashes running some code. How to troubleshoot it? - `Introduction <#introduction>`__ - `What ESP has to Say <#what-esp-has-to-say>`__ - `Get Your H/W Right <#get-your-hw-right>`__ +- `Enable compilation warnings <#enable-compilation-warnings>`__ - `What is the Cause of Restart? <#what-is-the-cause-of-restart>`__ - `Exception <#exception>`__ - `Watchdog <#watchdog>`__ @@ -73,6 +74,39 @@ In any case, make sure that your module is able to stably run standard example sketches that establish Wi-Fi connection like, e.g., `HelloServer.ino `__. +Enable compilation warnings +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Most common issues may be resolved by enabling compilation warnings and fixing them. + +For Arduino IDE, select ``File -> Preferences`` and select ``Show verbose output during: compilation`` +For PlatformIO, all warnings should be enabled by default. + +Notice that the default configuration of Arduino IDE inhibits **all** compilation warnings. +For the ESP8266 platform, some warnings should be treated as errors, otherwise it may cause unexpected issues at runtime: + +.. code:: cpp + + int func() { + } + + int other() { + return func(); + } + +Should fail to build with the following message: + +.. code:: console + + return-value.cpp: In function ‘int func()’: + return-value.cpp:2:1: error: no return statement in function returning non-void [-Werror=return-type] + 2 | } + | ^ + compilation terminated due to -Wfatal-errors. + cc1plus: some warnings being treated as errors + +Notice that ``-Werror=return-type`` is the default starting with Core 3.0.2 w/ GCC 10.3 + What is the Cause of Restart? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 3259fe83a5cf2e3d28caeeaf13c43515c95ba650 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Sun, 20 Feb 2022 18:27:15 +0300 Subject: [PATCH 2/3] backticks --- doc/faq/a02-my-esp-crashes.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/faq/a02-my-esp-crashes.rst b/doc/faq/a02-my-esp-crashes.rst index fe3135315d..59c5f6760f 100644 --- a/doc/faq/a02-my-esp-crashes.rst +++ b/doc/faq/a02-my-esp-crashes.rst @@ -79,8 +79,13 @@ Enable compilation warnings Most common issues may be resolved by enabling compilation warnings and fixing them. -For Arduino IDE, select ``File -> Preferences`` and select ``Show verbose output during: compilation`` -For PlatformIO, all warnings should be enabled by default. +For Arduino IDE: + +- Select ``File -> Preferences`` +- Make sure ``Show verbose output during: compilation`` is enabled +- Set ``Compiler warnings`` to ``More`` or ``All`` + +For PlatformIO, all warnings should already be enabled by default. Notice that the default configuration of Arduino IDE inhibits **all** compilation warnings. For the ESP8266 platform, some warnings should be treated as errors, otherwise it may cause unexpected issues at runtime: From 875480959accbeb6fe8b5f289040a71c25ad38fc Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Sun, 20 Feb 2022 18:27:50 +0300 Subject: [PATCH 3/3] list --- doc/faq/a02-my-esp-crashes.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/faq/a02-my-esp-crashes.rst b/doc/faq/a02-my-esp-crashes.rst index 59c5f6760f..1fcc2cbaa8 100644 --- a/doc/faq/a02-my-esp-crashes.rst +++ b/doc/faq/a02-my-esp-crashes.rst @@ -79,9 +79,8 @@ Enable compilation warnings Most common issues may be resolved by enabling compilation warnings and fixing them. -For Arduino IDE: +For Arduino IDE, select ``File -> Preferences``: -- Select ``File -> Preferences`` - Make sure ``Show verbose output during: compilation`` is enabled - Set ``Compiler warnings`` to ``More`` or ``All``