Using the compiler that comes with Arduino 1.0.5, it
authorJoseph Morrow <joseph.l.morrow@intel.com>
Fri, 5 Sep 2014 15:17:52 +0000 (11:17 -0400)
committerJoseph Morrow <joseph.l.morrow@intel.com>
Fri, 5 Sep 2014 15:18:57 +0000 (11:18 -0400)
complains that the token in the async struct cannot
have a size of zero.

I fixed it, since it's the end of the struct, this is okay.

Patch 2: Updated with respect to Sachin's comment review.

Patch 3: When building in debug mode, the compiler that
comes with Arduino 1.0.5 complains about the tokens defined
in pdu.h as well. In this patch as well, also removed errors
found when building in debug. Rebased on Sachins changeset.

Change-Id: I568481562af2a614624608851def5bf5aa68287a

csdk/libcoap-4.1.1/async.h
csdk/libcoap-4.1.1/pdu.c
csdk/libcoap-4.1.1/pdu.h

index 753fbc0..f455d97 100644 (file)
@@ -52,7 +52,7 @@ typedef struct coap_async_state_t {
   coap_address_t peer;         /**< the peer to notify */
   size_t tokenlen;             /**< length of the token */
 #pragma GCC diagnostic ignored "-pedantic"
-  unsigned char token[];       /**< the token to use in a response */
+  __extension__ unsigned char token[]; /**< the token to use in a response */
 #pragma GCC diagnostic warning "-pedantic"
 } coap_async_state_t;
 
index 4b9febf..10a007d 100644 (file)
@@ -9,7 +9,7 @@
 #include "config.h"
 
 #if defined(HAVE_ASSERT_H) && !defined(assert)
-# include <assert.h>
+#include <assert.h>
 #endif
 
 #include <stdlib.h>
index 7bccb2f..0a203e6 100644 (file)
@@ -169,7 +169,7 @@ typedef struct {
   unsigned int token_length:4; /* length of Token */
   unsigned int code:8;         /* request method (value 1--10) or response code (value 40-255) */
   unsigned short id;           /* message id */
-  unsigned char token[0];      /* the actual token, if any */
+  __extension__ unsigned char token[0];        /* the actual token, if any */
 } coap_hdr_t;
 #else
 typedef struct {
@@ -178,7 +178,7 @@ typedef struct {
   unsigned int version:2;      /* protocol version */
   unsigned int code:8;         /* request method (value 1--10) or response code (value 40-255) */
   unsigned short id;           /* transaction id (network byte order!) */
-  unsigned char token[0];      /* the actual token, if any */
+  __extension__ unsigned char token[0];        /* the actual token, if any */
 } coap_hdr_t;
 #endif
 #pragma GCC diagnostic warning "-pedantic"