Merge branch 'bugfix/cxx_gcc11_warnings' into 'master'

C++: fix several gcc11 warnings

Closes GCC-229

See merge request espressif/esp-idf!17658
This commit is contained in:
morris 2022-04-01 15:12:55 +08:00
commit 1459a09978
5 changed files with 19 additions and 30 deletions

View File

@ -20,7 +20,11 @@ extern "C" void tearDown()
TEST_CASE("std::out_of_range exception when -fno-exceptions", "[cxx][reset=abort,SW_CPU_RESET]")
{
std::vector<int> v(10);
// suppress warning because of this test
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
v.at(20) = 42;
#pragma GCC diagnostic pop
TEST_FAIL_MESSAGE("Unreachable because we are aborted on the line above");
}

View File

@ -1,19 +1,12 @@
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <string>
#include <algorithm>
#include <stdexcept>
#include "mqtt_client.h"
#include "esp_log.h"

View File

@ -1,16 +1,8 @@
// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ESP_EVENT_CXX_H_
#define ESP_EVENT_CXX_H_
@ -69,6 +61,7 @@ class ESPEventID {
public:
ESPEventID() : id(0) { }
explicit ESPEventID(int32_t event_id) : id(event_id) { }
ESPEventID(const ESPEventID &rhs) : id(rhs.id) { }
inline bool operator==(const ESPEventID &rhs) const {
return id == rhs.get_id();

View File

@ -1,7 +1,7 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: CC0
* SPDX-License-Identifier: CC0-1.0
*
* MPU9250 SPI Sensor C++ Example
*
@ -13,6 +13,7 @@
*/
#include <iostream>
#include <thread>
#include "spi_host_cxx.hpp"
using namespace std;

View File

@ -2054,7 +2054,6 @@ examples/cxx/experimental/esp_event_cxx/main/esp_event_cxx_example.cpp
examples/cxx/experimental/esp_modem_cxx/main/simple_client.cpp
examples/cxx/experimental/esp_modem_cxx/main/simple_mqtt_client.cpp
examples/cxx/experimental/esp_modem_cxx/main/simple_mqtt_client.hpp
examples/cxx/experimental/esp_mqtt_cxx/components/esp_mqtt_cxx/esp_mqtt_cxx.cpp
examples/cxx/experimental/esp_mqtt_cxx/components/esp_mqtt_cxx/include/esp_mqtt.hpp
examples/cxx/experimental/esp_mqtt_cxx/components/esp_mqtt_cxx/include/esp_mqtt_client_config.hpp
examples/cxx/experimental/esp_mqtt_cxx/ssl/main/mqtt_ssl_example.cpp
@ -2067,7 +2066,6 @@ examples/cxx/experimental/experimental_cpp_component/esp_timer_cxx.cpp
examples/cxx/experimental/experimental_cpp_component/host_test/esp_timer/main/esp_timer_test.cpp
examples/cxx/experimental/experimental_cpp_component/host_test/gpio/main/gpio_cxx_test.cpp
examples/cxx/experimental/experimental_cpp_component/include/esp_event_api.hpp
examples/cxx/experimental/experimental_cpp_component/include/esp_event_cxx.hpp
examples/cxx/experimental/experimental_cpp_component/include/esp_timer_cxx.hpp
examples/cxx/experimental/experimental_cpp_component/test/test_cxx_exceptions.cpp
examples/cxx/experimental/experimental_cpp_component/test/test_esp_event_cxx.cpp