Skip to content

Commit d30ae07

Browse files
author
Cruz Monrreal
authored
Merge pull request #8008 from deepikabhavnani/cleanup_features
Add required header file and namespace element instead add all
2 parents b16e271 + 9db31d2 commit d30ae07

File tree

22 files changed

+52
-29
lines changed

22 files changed

+52
-29
lines changed

TESTS/lorawan/loraradio/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939

4040
using namespace utest::v1;
41+
using namespace mbed;
4142

4243
static LoRaRadio *radio = NULL;
4344
rtos::Semaphore event_sem(0);

TESTS/mbed_platform/FileHandle/TestFile.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@
1818

1919
#include "platform/FileHandle.h"
2020

21-
2221
#define POS_IS_VALID(pos) (pos >= 0 && pos < _end)
2322
#define NEW_POS_IS_VALID(pos) (pos >= 0 && pos < (int32_t)FILE_SIZE)
2423
#define SEEK_POS_IS_VALID(pos) (pos >= 0 && pos <= _end)
2524
#define INVALID_POS (-1)
2625

2726
template<uint32_t FILE_SIZE>
28-
class TestFile : public FileHandle {
27+
class TestFile : public mbed::FileHandle {
2928
public:
3029
TestFile(): _pos(0), _end(0) {}
3130
~TestFile() {}

components/storage/blockdevice/COMPONENT_SPIF/TESTS/block_device/spif/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "utest.h"
1919
#include "SPIFBlockDevice.h"
2020
#include "mbed_trace.h"
21+
#include "rtos/Thread.h"
2122
#include <stdlib.h>
2223

2324
using namespace utest::v1;

features/device_key/TESTS/device_key/functionality/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#endif
2626

2727
using namespace utest::v1;
28+
using namespace mbed;
2829

2930
#define MSG_VALUE_DUMMY "0"
3031
#define MSG_VALUE_LEN 32

features/frameworks/greentea-client/source/greentea_metrics.cpp

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,10 @@
1515
* limitations under the License.
1616
*/
1717

18-
#include "mbed.h"
19-
#include "rtos.h"
20-
#include "mbed_stats.h"
21-
#include "cmsis_os2.h"
2218
#include "greentea-client/test_env.h"
2319
#include "greentea-client/greentea_metrics.h"
24-
#include "SingletonPtr.h"
25-
#include "CircularBuffer.h"
20+
#include "platform/mbed_stats.h"
21+
#include <stdint.h>
2622

2723
#define THREAD_BUF_COUNT 16
2824

@@ -33,6 +29,21 @@ typedef struct {
3329
} thread_info_t;
3430

3531
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
32+
33+
#if !defined(MBED_CONF_RTOS_PRESENT) || !(MBED_CONF_RTOS_PRESENT)
34+
#error "RTOS required for Stack stats"
35+
#endif
36+
37+
#include "rtos/Mutex.h"
38+
#include "rtos/Thread.h"
39+
#include "rtos/Kernel.h"
40+
#include "mbed_stats.h"
41+
#include "cmsis_os2.h"
42+
#include "platform/SingletonPtr.h"
43+
#include "platform/CircularBuffer.h"
44+
using namespace mbed;
45+
using namespace rtos;
46+
3647
// Mutex to protect "buf"
3748
static SingletonPtr<Mutex> mutex;
3849
static char buf[128];
@@ -43,7 +54,9 @@ static SingletonPtr<CircularBuffer<thread_info_t, THREAD_BUF_COUNT> > queue;
4354
static void send_CPU_info(void);
4455
#endif
4556

57+
#if defined(MBED_HEAP_STATS_ENABLED ) && MBED_HEAP_STATS_ENABLED
4658
static void send_heap_info(void);
59+
#endif
4760
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
4861
static void send_stack_info(void);
4962
static void on_thread_terminate(osThreadId_t id);
@@ -64,7 +77,9 @@ void greentea_metrics_setup()
6477

6578
void greentea_metrics_report()
6679
{
80+
#if defined(MBED_HEAP_STATS_ENABLED ) && MBED_HEAP_STATS_ENABLED
6781
send_heap_info();
82+
#endif
6883
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
6984
send_stack_info();
7085
Kernel::attach_thread_terminate_hook(NULL);
@@ -87,13 +102,15 @@ static void send_CPU_info()
87102
}
88103
#endif
89104

105+
#if defined(MBED_HEAP_STATS_ENABLED ) && MBED_HEAP_STATS_ENABLED
90106
static void send_heap_info()
91107
{
92108
mbed_stats_heap_t heap_stats;
93109
mbed_stats_heap_get(&heap_stats);
94110
greentea_send_kv("max_heap_usage",heap_stats.max_size);
95111
greentea_send_kv("reserved_heap",heap_stats.reserved_size);
96112
}
113+
#endif
97114

98115
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
99116
MBED_UNUSED static void send_stack_info()

features/frameworks/greentea-client/source/greentea_test_env.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <ctype.h>
1919
#include <cstdio>
2020
#include <string.h>
21-
#include "mbed.h"
2221
#include "greentea-client/test_env.h"
2322
#include "greentea-client/greentea_serial.h"
2423
#include "greentea-client/greentea_metrics.h"

features/frameworks/utest/mbed-utest-shim.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
* limitations under the License.
1616
*/
1717

18-
#include "mbed.h"
1918
#include "mbed_critical.h"
2019
#include "utest/utest.h"
2120

features/frameworks/utest/source/utest_shim.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ utest_v1_scheduler_t utest_v1_get_scheduler()
5858
#ifdef YOTTA_MBED_HAL_VERSION_STRING
5959
# include "mbed-hal/us_ticker_api.h"
6060
#else
61-
# include "mbed.h"
61+
#include "platform/SingletonPtr.h"
62+
#include "Timeout.h"
63+
using mbed::Timeout;
6264
#endif
6365

6466
// only one callback is active at any given time

features/frameworks/utest/source/utest_stack_trace.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#ifdef UTEST_STACK_TRACE
1818

1919
#include "greentea-client/test_env.h"
20-
#include "mbed.h"
2120
#include "utest/utest.h"
2221
#include "unity/unity.h"
2322
#include "utest/utest_stack_trace.h"

features/frameworks/utest/utest/utest_scheduler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#ifndef UTEST_SCHEDULER_H
2323
#define UTEST_SCHEDULER_H
2424

25-
#include "mbed.h"
25+
#include "hal/ticker_api.h"
2626
#include <stdint.h>
2727
#include <stdbool.h>
2828
#include <stdio.h>

features/nanostack/mbed-mesh-api/source/LoWPANNDInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Nanostack::LoWPANNDInterface *LoWPANNDInterface::get_interface() const
3535
nsapi_error_t LoWPANNDInterface::do_initialize()
3636
{
3737
if (!_interface) {
38-
_interface = new (nothrow) Nanostack::LoWPANNDInterface(*_phy);
38+
_interface = new (std::nothrow) Nanostack::LoWPANNDInterface(*_phy);
3939
if (!_interface) {
4040
return NSAPI_ERROR_NO_MEMORY;
4141
}

features/nanostack/mbed-mesh-api/source/NanostackEMACInterface.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
* Copyright (c) 2017 ARM Limited. All rights reserved.
33
*/
44

5-
#include "Nanostack.h"
65
#include "NanostackEthernetInterface.h"
76
#include "NanostackEthernetPhy.h"
8-
#include "EMAC.h"
97
#include "nsdynmemLIB.h"
108
#include "arm_hal_phy.h"
9+
#include "EMAC.h"
1110

1211
class EMACPhy : public NanostackEthernetPhy
1312
{
@@ -138,7 +137,7 @@ int8_t EMACPhy::phy_register()
138137
phy.phy_tx_done_cb = NULL;
139138

140139
emac.set_memory_manager(memory_manager);
141-
emac.set_link_input_cb(callback(this, &EMACPhy::emac_phy_rx));
140+
emac.set_link_input_cb(mbed::callback(this, &EMACPhy::emac_phy_rx));
142141

143142
if (!emac.power_up()) {
144143
return -1;
@@ -183,7 +182,7 @@ nsapi_error_t Nanostack::add_ethernet_interface(EMAC &emac, bool default_if, Nan
183182
return NSAPI_ERROR_DEVICE_ERROR;
184183
}
185184

186-
single_phy = new (nothrow) EMACPhy(this->memory_manager, emac);
185+
single_phy = new (std::nothrow) EMACPhy(this->memory_manager, emac);
187186
if (!single_phy) {
188187
return NSAPI_ERROR_NO_MEMORY;
189188
}
@@ -194,7 +193,7 @@ nsapi_error_t Nanostack::add_ethernet_interface(EMAC &emac, bool default_if, Nan
194193

195194
Nanostack::EthernetInterface *interface;
196195

197-
interface = new (nothrow) Nanostack::EthernetInterface(*single_phy);
196+
interface = new (std::nothrow) Nanostack::EthernetInterface(*single_phy);
198197
if (!interface) {
199198
return NSAPI_ERROR_NO_MEMORY;
200199
}

features/nanostack/mbed-mesh-api/source/NanostackEthernetInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ nsapi_error_t NanostackEthernetInterface::initialize(NanostackEthernetPhy *phy)
3838
return NSAPI_ERROR_PARAMETER;
3939
}
4040

41-
_interface = new (nothrow) Nanostack::EthernetInterface(*phy);
41+
_interface = new (std::nothrow) Nanostack::EthernetInterface(*phy);
4242
if (!_interface) {
4343
return NSAPI_ERROR_NO_MEMORY;
4444
}

features/nanostack/mbed-mesh-api/source/ThreadInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Nanostack::ThreadInterface *ThreadInterface::get_interface() const
7979
nsapi_error_t ThreadInterface::do_initialize()
8080
{
8181
if (!_interface) {
82-
_interface = new (nothrow) Nanostack::ThreadInterface(*_phy);
82+
_interface = new (std::nothrow) Nanostack::ThreadInterface(*_phy);
8383
if (!_interface) {
8484
return NSAPI_ERROR_NO_MEMORY;
8585
}

features/nanostack/nanostack-hal-mbed-cmsis-rtos/arm_hal_timer.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@
1717
// Include before mbed.h to properly get UINT*_C()
1818
#include "ns_types.h"
1919

20-
#include "mbed.h"
2120
#include "platform/SingletonPtr.h"
2221
#include "platform/arm_hal_timer.h"
2322
#include "platform/arm_hal_interrupt.h"
24-
#include <mbed_assert.h>
23+
#include "platform/mbed_assert.h"
24+
#include "Timeout.h"
25+
#include "Timer.h"
26+
#include "events/Event.h"
27+
#include "events/mbed_shared_queues.h"
28+
29+
using namespace mbed;
30+
using namespace events;
2531

2632
static SingletonPtr<Timer> timer;
2733
static SingletonPtr<Timeout> timeout;

features/nanostack/nanostack-interface/Nanostack.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
/* Nanostack implementation of NetworkSocketAPI */
1919

20-
#include "mbed.h"
21-
#include "rtos.h"
2220
#include "Nanostack.h"
2321
#include "NanostackLockGuard.h"
2422

features/nanostack/nanostack-interface/Nanostack.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#ifndef NANOSTACK_H_
1919
#define NANOSTACK_H_
2020

21-
#include "mbed.h"
2221
#include "OnboardNetworkStack.h"
2322
#include "NanostackMemoryManager.h"
2423
#include "MeshInterface.h"

features/netsocket/EMACInterface.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
#include "EMACInterface.h"
18+
using namespace mbed;
1819

1920
/* Interface implementation */
2021
EMACInterface::EMACInterface(EMAC &emac, OnboardNetworkStack &stack) :

features/netsocket/EMACInterface.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#define EMAC_INTERFACE_H
1919

2020
#include "nsapi.h"
21-
#include "rtos.h"
2221
#include "EMAC.h"
2322
#include "OnboardNetworkStack.h"
2423

features/netsocket/EthernetInterface.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#define ETHERNET_INTERFACE_H
1919

2020
#include "nsapi.h"
21-
#include "rtos.h"
2221
#include "EMACInterface.h"
2322

2423

features/netsocket/TCPServer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
*/
1616

1717
#include "TCPServer.h"
18-
#include "mbed.h"
18+
19+
using mbed::Callback;
1920

2021
TCPServer::TCPServer()
2122
{

features/storage/TESTS/filesystem/general_filesystem/main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#include "utest/utest.h"
1919
#include "BlockDevice.h"
2020
#include "FileSystem.h"
21+
22+
#include <stdlib.h>
2123
#if COMPONENT_SPIF
2224
#include "SPIFBlockDevice.h"
2325
#include "LittleFileSystem.h"
@@ -32,6 +34,7 @@
3234
#endif
3335

3436
using namespace utest::v1;
37+
using namespace mbed;
3538

3639
static const size_t small_buf_size = 10;
3740
static const size_t medium_buf_size = 250;

0 commit comments

Comments
 (0)