Navigation Menu

Skip to content

Commit

Permalink
gcc 5.4.x fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeuz committed Nov 25, 2016
1 parent 1a1ee73 commit bbc97f1
Show file tree
Hide file tree
Showing 13 changed files with 55 additions and 31 deletions.
9 changes: 4 additions & 5 deletions build/module.mk
Expand Up @@ -29,10 +29,9 @@ CFLAGS += $(addprefix -D,$(GLOBAL_DEFINES))
export GLOBAL_DEFINES
endif

# fixes build errors on ubuntu with arm gcc 5.3.1
# GNU_SOURCE is needed for isascii/toascii
# WINSOCK_H stops select.h from being used which conflicts with CC3000 headers
CFLAGS += -D_GNU_SOURCE -D_WINSOCK_H
# fixes build errors on ubuntu with arm gcc 5.x
# _POSIX_C_SOURCE selects latest POSIX-conforming API
CFLAGS += -D_POSIX_C_SOURCE=200809

# Global category name for logging
ifneq (,$(LOG_MODULE_CATEGORY))
Expand Down Expand Up @@ -280,7 +279,7 @@ $(BUILD_PATH)/%.o : $(COMMON_BUILD)/arm/%.S
$(VERBOSE)$(CC) $(ASFLAGS) -c -o $@ $<
$(call echo,)


# Other Targets
clean: clean_deps
$(VERBOSE)$(RM) $(ALLOBJ) $(ALLDEPS) $(TARGET)
Expand Down
1 change: 1 addition & 0 deletions communication/src/dtls_message_channel.cpp
Expand Up @@ -26,6 +26,7 @@
#include "timer_hal.h"
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include "dtls_session_persist.h"
#include "service_debug.h"

Expand Down
2 changes: 2 additions & 0 deletions communication/src/publisher.h
Expand Up @@ -26,6 +26,8 @@

#include "completion_handler.h"

#include <strings.h>

namespace particle
{
namespace protocol
Expand Down
1 change: 1 addition & 0 deletions communication/src/spark_protocol.cpp
Expand Up @@ -28,6 +28,7 @@
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <strings.h>
#include "device_keys.h"
#include "service_debug.h"
#include "messages.h"
Expand Down
4 changes: 0 additions & 4 deletions hal/src/core/sources.mk
Expand Up @@ -22,7 +22,3 @@ CPPSRC += $(call target_files,$(HAL_SRC_STM32_PATH)/,*.cpp)

# ASM source files included in this build.
ASRC +=

# Stick to some POSIX-conforming API to disable BSD extensions
CFLAGS += -D_POSIX_C_SOURCE=200809

5 changes: 5 additions & 0 deletions modules/electron/system-part3/src/export_rt.c
@@ -1,4 +1,9 @@
#define DYNALIB_EXPORT

#ifndef _GNU_SOURCE
#define _GNU_SOURCE // for siprintf(), siscanf() and other extensions
#endif

#include <stdlib.h> // for malloc, free, realloc
#include <stdio.h>
#include <stdarg.h> // for va_list
Expand Down
2 changes: 1 addition & 1 deletion modules/photon/system-part1/linker.ld
Expand Up @@ -3,7 +3,7 @@ MEMORY
APP_FLASH (rx) : ORIGIN = 0x08020000, LENGTH = 256K

/* todo - SRAM must start also at an offset after what has been reserved for system-module 1 */
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 384
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 1K
}

INCLUDE module_system_part1_export.ld
Expand Down
5 changes: 5 additions & 0 deletions modules/photon/system-part2/src/export_rt.c
@@ -1,4 +1,9 @@
#define DYNALIB_EXPORT

#ifndef _GNU_SOURCE
#define _GNU_SOURCE // for siprintf(), siscanf() and other extensions
#endif

#include <stdlib.h> // for malloc, free, realloc
#include <stdio.h>
#include <stdarg.h> // for va_list
Expand Down
3 changes: 2 additions & 1 deletion newlib_nano/src/mallocr.c
Expand Up @@ -43,7 +43,8 @@
#define DEFINE_FREE
#define DEFINE_REALLOC
#define DEFINE_CALLOC
#define DEFINE_MALLOC_STATS
// Do not compile malloc_stats() function (dumps memory usage stats to console)
// #define DEFINE_MALLOC_STATS
#define DEFINE_MALLOC_USABLE_SIZE
#define DEFINE_MALLOPT
#define DEFINE_PALLOC
Expand Down
4 changes: 0 additions & 4 deletions platform/NET/build.mk
Expand Up @@ -5,7 +5,3 @@

PLATFORM_NET_PATH = $(PLATFORM_MODULE_PATH)/NET/$(PLATFORM_NET)
include $(call rwildcard,$(PLATFORM_NET_PATH)/,sources.mk)

# Stick to some POSIX-conforming API to disable BSD extensions
CFLAGS += -D_POSIX_C_SOURCE=200809

5 changes: 0 additions & 5 deletions user/build.mk
Expand Up @@ -76,11 +76,6 @@ CFLAGS += $(addprefix -fno-builtin-,$(BUILTINS_EXCLUDE))

CFLAGS += $(EXTRA_CFLAGS)

ifeq ("$(PLATFORM_NET)", "CC3000")
# Stick to some POSIX-conforming API to disable BSD extensions
CPPFLAGS += -D_POSIX_C_SOURCE=200809
endif

# Use application source info regardless of release/debug build
CFLAGS += -DLOG_INCLUDE_SOURCE_INFO=1
LOG_MODULE_CATEGORY = app
14 changes: 3 additions & 11 deletions wiring/inc/spark_wiring_character.h
Expand Up @@ -44,11 +44,6 @@ inline boolean isAlphaNumeric(int c)
return toBoolean(isalnum(c));
}

inline boolean isAscii(int c)
{
return toBoolean(isascii(c));
}

inline boolean isControl(int c)
{
return toBoolean(iscntrl(c));
Expand Down Expand Up @@ -99,11 +94,6 @@ inline boolean isWhitespace(int c)
return toBoolean(isblank(c));
}

inline int toAscii(int c)
{
return toascii(c);
}

inline int toLowerCase(int c)
{
return tolower(c);
Expand All @@ -114,5 +104,7 @@ inline int toUpperCase(int c)
return toupper(c);
}

#endif /* SPARK_WIRING_CHARACTER_H */
boolean isAscii(int c);
int toAscii(int c);

#endif /* SPARK_WIRING_CHARACTER_H */
31 changes: 31 additions & 0 deletions wiring/src/spark_wiring_character.cpp
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2016 Particle Industries, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _GNU_SOURCE
#define _GNU_SOURCE // for isascii() and toascii()
#endif
#include <cctype>

#include "spark_wiring_character.h"

boolean isAscii(int c) {
return toBoolean(isascii(c));
}

int toAscii(int c) {
return toascii(c);
}

0 comments on commit bbc97f1

Please sign in to comment.