Skip to content

Commit

Permalink
cellular: AT: fix build on ARMCC5
Browse files Browse the repository at this point in the history
ARMC5 failed to compile the code with debug-profile (!!) as va_list
is getting into std:: namespace when one includes <cstdarg>. Other
compilers seem to be more relaxed, and so is ARMC5 if compiled
with other profiles.

Add the explicit std:: to references of va_list.

While here, remove one extra copy of "#include "PlatformMutex.h""
and a "#include <stdarg.h>" which is kind of duplicate of
"#include <cstdarg>".

Error being fixed:
--8<--8<--8<--
Compile [ 81.8%]: ATHandler.cpp
[Error] ATHandler.h@552,0:  #20: identifier "va_list" is undefined
[Error] ATHandler.cpp@1226,0:  #147: declaration is incompatible with "void mbed::ATHandler::handle_args(const char *, <error-type>)"  (declared at line 552 of "./mbed-os/features/cellular/framework/AT/ATHandler.h")
[ERROR] "./mbed-os/features/cellular/framework/AT/ATHandler.h", line 552: Error:  #20: identifier "va_list" is undefined
"./mbed-os/features/cellular/framework/AT/ATHandler.cpp", line 1226: Error:  #147: declaration is incompatible with "void mbed::ATHandler::handle_args(const char *, <error-type>)"  (declared at line 552 of "./mbed-os/features/cellular/framework/AT/ATHandler.h")
./mbed-os/features/cellular/framework/AT/ATHandler.cpp: 0 warnings, 2 errors
  • Loading branch information
TeroJaasko committed Jun 26, 2019
1 parent 14bb439 commit bae3043
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions features/cellular/framework/AT/ATHandler.cpp
Expand Up @@ -26,7 +26,6 @@
#include "rtos/ThisThread.h"
#include "Kernel.h"
#include "CellularUtil.h"
#include <stdarg.h>
#include "SingletonPtr.h"

using namespace mbed;
Expand Down Expand Up @@ -1223,7 +1222,7 @@ void ATHandler::cmd_start(const char *cmd)
_cmd_start = true;
}

void ATHandler::handle_args(const char *format, va_list list)
void ATHandler::handle_args(const char *format, std::va_list list)
{
while (*format != '\0') {
if (*format == 'd') {
Expand Down
4 changes: 2 additions & 2 deletions features/cellular/framework/AT/ATHandler.h
Expand Up @@ -24,8 +24,8 @@
#include "PlatformMutex.h"
#include "nsapi_types.h"

#include "PlatformMutex.h"
#include "Callback.h"

#include <cstdarg>

namespace mbed {
Expand Down Expand Up @@ -549,7 +549,7 @@ class ATHandler {

private:
//Handles the arguments from given variadic list
void handle_args(const char *format, va_list list);
void handle_args(const char *format, std::va_list list);

//Starts an AT command based on given parameters
void handle_start(const char *cmd, const char *cmd_chr);
Expand Down

0 comments on commit bae3043

Please sign in to comment.