Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes a few Warnings and fixes Math rand() to work like Arduino mainstream #7613

Merged
merged 4 commits into from
Dec 21, 2022

Conversation

SuGlider
Copy link
Collaborator

Description of Change

This is part of a work to clean up Warnings from the core. The flags below are not necessary anymore:

-Wno-frame-address 
-Wno-error=unused-function 
-Wno-error=unused-variable 
-Wno-error=deprecated-declarations 
-Wno-sign-compare 
-Wwrite-strings
-Wno-error=unused-but-set-variable 
-Wno-old-style-declaration

But we still need -Wno-unused-parameter because IDF inline declarations use some parameters that are not used dependening on #define

This PR also fixes Math rand(negative parameter) in order to make it work exactly as it does in Arduino mainstream.

  Serial.println("random(-5) ::");
  for (uint8_t i = 0; i < 10; i++) {
  Serial.print(random(-5));
  Serial.print(" | ");
  }
  Serial.println();

  Serial.println("random(-3, 3) ::");
  for (uint8_t i = 0; i < 10; i++) {
  Serial.print(random(-3, 3));
  Serial.print(" | ");
  }
  Serial.println();

Tests scenarios

Tested with ESP32 WROVER-E, using a modified platform.txt with this change:

compiler.c.flags.esp32=-Wno-unused-parameter -mlongcalls -ffunction-sections -fdata-sections -ggdb -freorder-blocks -fstack-protector -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -std=gnu99  -MMD -c

compiler.cpp.flags.esp32=-Wno-unused-parameter -mlongcalls -ffunction-sections -fdata-sections -ggdb -freorder-blocks -fstack-protector -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -std=gnu++11 -fexceptions -fno-rtti  -MMD -c

Related links

It is a pre requisite for merging #7060

@SuGlider SuGlider added this to the 2.0.6 milestone Dec 21, 2022
@SuGlider SuGlider self-assigned this Dec 21, 2022
@me-no-dev me-no-dev merged commit 2333df5 into espressif:master Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants