Skip to content

Add required header file and namespace element instead add all #8008

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

Merged
merged 5 commits into from
Oct 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions TESTS/lorawan/loraradio/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@


using namespace utest::v1;
using namespace mbed;

static LoRaRadio *radio = NULL;
rtos::Semaphore event_sem(0);
Expand Down
3 changes: 1 addition & 2 deletions TESTS/mbed_platform/FileHandle/TestFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@

#include "platform/FileHandle.h"


#define POS_IS_VALID(pos) (pos >= 0 && pos < _end)
#define NEW_POS_IS_VALID(pos) (pos >= 0 && pos < (int32_t)FILE_SIZE)
#define SEEK_POS_IS_VALID(pos) (pos >= 0 && pos <= _end)
#define INVALID_POS (-1)

template<uint32_t FILE_SIZE>
class TestFile : public FileHandle {
class TestFile : public mbed::FileHandle {
public:
TestFile(): _pos(0), _end(0) {}
~TestFile() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "utest.h"
#include "SPIFBlockDevice.h"
#include "mbed_trace.h"
#include "rtos/Thread.h"
#include <stdlib.h>

using namespace utest::v1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#endif

using namespace utest::v1;
using namespace mbed;

#define MSG_VALUE_DUMMY "0"
#define MSG_VALUE_LEN 32
Expand Down
29 changes: 23 additions & 6 deletions features/frameworks/greentea-client/source/greentea_metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@
* limitations under the License.
*/

#include "mbed.h"
#include "rtos.h"
#include "mbed_stats.h"
#include "cmsis_os2.h"
#include "greentea-client/test_env.h"
#include "greentea-client/greentea_metrics.h"
#include "SingletonPtr.h"
#include "CircularBuffer.h"
#include "platform/mbed_stats.h"
#include <stdint.h>

#define THREAD_BUF_COUNT 16

Expand All @@ -33,6 +29,21 @@ typedef struct {
} thread_info_t;

#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED

#if !defined(MBED_CONF_RTOS_PRESENT) || !(MBED_CONF_RTOS_PRESENT)
#error "RTOS required for Stack stats"
#endif

#include "rtos/Mutex.h"
#include "rtos/Thread.h"
#include "rtos/Kernel.h"
#include "mbed_stats.h"
#include "cmsis_os2.h"
#include "platform/SingletonPtr.h"
#include "platform/CircularBuffer.h"
using namespace mbed;
using namespace rtos;

// Mutex to protect "buf"
static SingletonPtr<Mutex> mutex;
static char buf[128];
Expand All @@ -43,7 +54,9 @@ static SingletonPtr<CircularBuffer<thread_info_t, THREAD_BUF_COUNT> > queue;
static void send_CPU_info(void);
#endif

#if defined(MBED_HEAP_STATS_ENABLED ) && MBED_HEAP_STATS_ENABLED
static void send_heap_info(void);
#endif
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
static void send_stack_info(void);
static void on_thread_terminate(osThreadId_t id);
Expand All @@ -64,7 +77,9 @@ void greentea_metrics_setup()

void greentea_metrics_report()
{
#if defined(MBED_HEAP_STATS_ENABLED ) && MBED_HEAP_STATS_ENABLED
send_heap_info();
#endif
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
send_stack_info();
Kernel::attach_thread_terminate_hook(NULL);
Expand All @@ -87,13 +102,15 @@ static void send_CPU_info()
}
#endif

#if defined(MBED_HEAP_STATS_ENABLED ) && MBED_HEAP_STATS_ENABLED
static void send_heap_info()
{
mbed_stats_heap_t heap_stats;
mbed_stats_heap_get(&heap_stats);
greentea_send_kv("max_heap_usage",heap_stats.max_size);
greentea_send_kv("reserved_heap",heap_stats.reserved_size);
}
#endif

#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
MBED_UNUSED static void send_stack_info()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <ctype.h>
#include <cstdio>
#include <string.h>
#include "mbed.h"
#include "greentea-client/test_env.h"
#include "greentea-client/greentea_serial.h"
#include "greentea-client/greentea_metrics.h"
Expand Down
1 change: 0 additions & 1 deletion features/frameworks/utest/mbed-utest-shim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/

#include "mbed.h"
#include "mbed_critical.h"
#include "utest/utest.h"

Expand Down
4 changes: 3 additions & 1 deletion features/frameworks/utest/source/utest_shim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ utest_v1_scheduler_t utest_v1_get_scheduler()
#ifdef YOTTA_MBED_HAL_VERSION_STRING
# include "mbed-hal/us_ticker_api.h"
#else
# include "mbed.h"
#include "platform/SingletonPtr.h"
#include "Timeout.h"
using mbed::Timeout;
#endif

// only one callback is active at any given time
Expand Down
1 change: 0 additions & 1 deletion features/frameworks/utest/source/utest_stack_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#ifdef UTEST_STACK_TRACE

#include "greentea-client/test_env.h"
#include "mbed.h"
#include "utest/utest.h"
#include "unity/unity.h"
#include "utest/utest_stack_trace.h"
Expand Down
2 changes: 1 addition & 1 deletion features/frameworks/utest/utest/utest_scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#ifndef UTEST_SCHEDULER_H
#define UTEST_SCHEDULER_H

#include "mbed.h"
#include "hal/ticker_api.h"
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Nanostack::LoWPANNDInterface *LoWPANNDInterface::get_interface() const
nsapi_error_t LoWPANNDInterface::do_initialize()
{
if (!_interface) {
_interface = new (nothrow) Nanostack::LoWPANNDInterface(*_phy);
_interface = new (std::nothrow) Nanostack::LoWPANNDInterface(*_phy);
if (!_interface) {
return NSAPI_ERROR_NO_MEMORY;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
* Copyright (c) 2017 ARM Limited. All rights reserved.
*/

#include "Nanostack.h"
#include "NanostackEthernetInterface.h"
#include "NanostackEthernetPhy.h"
#include "EMAC.h"
#include "nsdynmemLIB.h"
#include "arm_hal_phy.h"
#include "EMAC.h"

class EMACPhy : public NanostackEthernetPhy
{
Expand Down Expand Up @@ -138,7 +137,7 @@ int8_t EMACPhy::phy_register()
phy.phy_tx_done_cb = NULL;

emac.set_memory_manager(memory_manager);
emac.set_link_input_cb(callback(this, &EMACPhy::emac_phy_rx));
emac.set_link_input_cb(mbed::callback(this, &EMACPhy::emac_phy_rx));

if (!emac.power_up()) {
return -1;
Expand Down Expand Up @@ -183,7 +182,7 @@ nsapi_error_t Nanostack::add_ethernet_interface(EMAC &emac, bool default_if, Nan
return NSAPI_ERROR_DEVICE_ERROR;
}

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

Nanostack::EthernetInterface *interface;

interface = new (nothrow) Nanostack::EthernetInterface(*single_phy);
interface = new (std::nothrow) Nanostack::EthernetInterface(*single_phy);
if (!interface) {
return NSAPI_ERROR_NO_MEMORY;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ nsapi_error_t NanostackEthernetInterface::initialize(NanostackEthernetPhy *phy)
return NSAPI_ERROR_PARAMETER;
}

_interface = new (nothrow) Nanostack::EthernetInterface(*phy);
_interface = new (std::nothrow) Nanostack::EthernetInterface(*phy);
if (!_interface) {
return NSAPI_ERROR_NO_MEMORY;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Nanostack::ThreadInterface *ThreadInterface::get_interface() const
nsapi_error_t ThreadInterface::do_initialize()
{
if (!_interface) {
_interface = new (nothrow) Nanostack::ThreadInterface(*_phy);
_interface = new (std::nothrow) Nanostack::ThreadInterface(*_phy);
if (!_interface) {
return NSAPI_ERROR_NO_MEMORY;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@
// Include before mbed.h to properly get UINT*_C()
#include "ns_types.h"

#include "mbed.h"
#include "platform/SingletonPtr.h"
#include "platform/arm_hal_timer.h"
#include "platform/arm_hal_interrupt.h"
#include <mbed_assert.h>
#include "platform/mbed_assert.h"
#include "Timeout.h"
#include "Timer.h"
#include "events/Event.h"
#include "events/mbed_shared_queues.h"

using namespace mbed;
using namespace events;

static SingletonPtr<Timer> timer;
static SingletonPtr<Timeout> timeout;
Expand Down
2 changes: 0 additions & 2 deletions features/nanostack/nanostack-interface/Nanostack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

/* Nanostack implementation of NetworkSocketAPI */

#include "mbed.h"
#include "rtos.h"
#include "Nanostack.h"
#include "NanostackLockGuard.h"

Expand Down
1 change: 0 additions & 1 deletion features/nanostack/nanostack-interface/Nanostack.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#ifndef NANOSTACK_H_
#define NANOSTACK_H_

#include "mbed.h"
#include "OnboardNetworkStack.h"
#include "NanostackMemoryManager.h"
#include "MeshInterface.h"
Expand Down
1 change: 1 addition & 0 deletions features/netsocket/EMACInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

#include "EMACInterface.h"
using namespace mbed;

/* Interface implementation */
EMACInterface::EMACInterface(EMAC &emac, OnboardNetworkStack &stack) :
Expand Down
1 change: 0 additions & 1 deletion features/netsocket/EMACInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#define EMAC_INTERFACE_H

#include "nsapi.h"
#include "rtos.h"
#include "EMAC.h"
#include "OnboardNetworkStack.h"

Expand Down
1 change: 0 additions & 1 deletion features/netsocket/EthernetInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#define ETHERNET_INTERFACE_H

#include "nsapi.h"
#include "rtos.h"
#include "EMACInterface.h"


Expand Down
3 changes: 2 additions & 1 deletion features/netsocket/TCPServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
*/

#include "TCPServer.h"
#include "mbed.h"

using mbed::Callback;

TCPServer::TCPServer()
{
Expand Down
3 changes: 3 additions & 0 deletions features/storage/TESTS/filesystem/general_filesystem/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include "utest/utest.h"
#include "BlockDevice.h"
#include "FileSystem.h"

#include <stdlib.h>
#if COMPONENT_SPIF
#include "SPIFBlockDevice.h"
#include "LittleFileSystem.h"
Expand All @@ -32,6 +34,7 @@
#endif

using namespace utest::v1;
using namespace mbed;

static const size_t small_buf_size = 10;
static const size_t medium_buf_size = 250;
Expand Down