Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit 2ffb46c

Browse files
authored
Merge pull request #35 from per1234/ci-warnings
Set CI build warning level to -Wall -Wextra -Wpedantic -Werror and fix all warnings
2 parents 50ce707 + a7c9777 commit 2ffb46c

19 files changed

+72
-33
lines changed

src/ArduinoCloudProperty.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static unsigned long getTimestamp() {
2626
#ifdef ARDUINO_ARCH_SAMD
2727
return rtc.getEpoch();
2828
#else
29-
#warning "No RTC available on this architecture - ArduinoIoTCloud will not keep track of local change timestamps ."
29+
#pragma message "No RTC available on this architecture - ArduinoIoTCloud will not keep track of local change timestamps ."
3030
return 0;
3131
#endif
3232
}
@@ -35,19 +35,19 @@ static unsigned long getTimestamp() {
3535
CTOR/DTOR
3636
******************************************************************************/
3737
ArduinoCloudProperty::ArduinoCloudProperty()
38-
: _name(""),
39-
_permission(Permission::Read),
40-
_update_callback_func(nullptr),
41-
_sync_callback_func(nullptr),
42-
_has_been_updated_once(false),
43-
_has_been_modified_in_callback(false),
44-
_min_delta_property(0.0f),
45-
_min_time_between_updates_millis(0),
46-
_last_updated_millis(0),
47-
_update_interval_millis(0),
48-
_last_local_change_timestamp(0),
49-
_last_cloud_change_timestamp(0),
50-
_map_data_list(nullptr) {
38+
: _name(""),
39+
_min_delta_property(0.0f),
40+
_min_time_between_updates_millis(0),
41+
_permission(Permission::Read),
42+
_update_callback_func(nullptr),
43+
_sync_callback_func(nullptr),
44+
_has_been_updated_once(false),
45+
_has_been_modified_in_callback(false),
46+
_last_updated_millis(0),
47+
_update_interval_millis(0),
48+
_last_local_change_timestamp(0),
49+
_last_cloud_change_timestamp(0),
50+
_map_data_list(nullptr) {
5151
}
5252

5353
/******************************************************************************

src/ArduinoCloudProperty.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,9 @@ class ArduinoCloudProperty {
178178
};
179179
protected:
180180
/* Variables used for UpdatePolicy::OnChange */
181+
String _name;
181182
float _min_delta_property;
182183
unsigned long _min_time_between_updates_millis;
183-
String _name;
184184

185185
private:
186186
Permission _permission;

src/ArduinoCloudThing.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ ArduinoCloudThing::ArduinoCloudThing() :
4747
_numPrimitivesProperties(0),
4848
_isSyncMessage(false),
4949
_currentPropertyName(""),
50-
_currentPropertyTime(0),
51-
_currentPropertyBaseTime(0)
50+
_currentPropertyBaseTime(0),
51+
_currentPropertyTime(0)
5252
{}
5353

5454
/******************************************************************************
@@ -515,5 +515,5 @@ void onForceCloudSync(ArduinoCloudProperty & property) {
515515
property.execCallbackOnChange();
516516
}
517517

518-
void onForceDeviceSync(ArduinoCloudProperty & property) {
518+
void onForceDeviceSync(ArduinoCloudProperty & /* property */) {
519519
}

src/ArduinoCloudThing.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
CONSTANTS
3737
******************************************************************************/
3838

39-
static bool ON = true;
40-
static bool OFF = false;
39+
static bool const ON = true;
40+
static bool const OFF = false;
4141

4242
static long const ON_CHANGE = -1;
4343
static long const SECONDS = 1;

src/lib/tinycbor/src/cborencoder.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
#include <stdlib.h>
4040
#include <string.h>
4141

42+
#pragma GCC diagnostic push
43+
#pragma GCC diagnostic ignored "-Wpedantic"
44+
4245
/**
4346
* \defgroup CborEncoding Encoding to CBOR
4447
* \brief Group of functions used to encode data to CBOR.
@@ -642,4 +645,6 @@ CborError cbor_encoder_close_container(CborEncoder *encoder, const CborEncoder *
642645
* \sa cbor_encoder_init(), cbor_encoder_get_buffer_size(), CborEncoding
643646
*/
644647

648+
#pragma GCC diagnostic pop
649+
645650
/** @} */

src/lib/tinycbor/src/cborencoder_close_container_checked.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030

3131
#include "cbor.h"
3232

33+
#pragma GCC diagnostic push
34+
#pragma GCC diagnostic ignored "-Wpedantic"
35+
3336
/**
3437
* \addtogroup CborEncoding
3538
* @{
@@ -54,4 +57,6 @@ CborError cbor_encoder_close_container_checked(CborEncoder *encoder, const CborE
5457
return cbor_encoder_close_container(encoder, containerEncoder);
5558
}
5659

60+
#pragma GCC diagnostic pop
61+
5762
/** @} */

src/lib/tinycbor/src/cborerrorstrings.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
# define _(msg) msg
2929
#endif
3030

31+
#pragma GCC diagnostic push
32+
#pragma GCC diagnostic ignored "-Wpedantic"
33+
3134
/**
3235
* \enum CborError
3336
* \ingroup CborGlobals
@@ -180,3 +183,5 @@ const char *cbor_error_string(CborError error)
180183
}
181184
return cbor_error_string(CborUnknownError);
182185
}
186+
187+
#pragma GCC diagnostic pop

src/lib/tinycbor/src/cborparser.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838

3939
#include <string.h>
4040

41+
#pragma GCC diagnostic push
42+
#pragma GCC diagnostic ignored "-Wpedantic"
43+
4144
/**
4245
* \defgroup CborParsing Parsing CBOR streams
4346
* \brief Group of functions used to parse CBOR streams.
@@ -1427,4 +1430,6 @@ CborError cbor_value_get_half_float(const CborValue *value, void *result)
14271430
return CborNoError;
14281431
}
14291432

1433+
#pragma GCC diagnostic pop
1434+
14301435
/** @} */

src/lib/tinycbor/src/cborparser_dup_string.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
#include "compilersupport_p.h"
3737
#include <stdlib.h>
3838

39+
#pragma GCC diagnostic push
40+
#pragma GCC diagnostic ignored "-Wpedantic"
41+
3942
/**
4043
* \fn CborError cbor_value_dup_text_string(const CborValue *value, char **buffer, size_t *buflen, CborValue *next)
4144
*
@@ -117,3 +120,5 @@ CborError _cbor_value_dup_string(const CborValue *value, void **buffer, size_t *
117120
}
118121
return CborNoError;
119122
}
123+
124+
#pragma GCC diagnostic pop

src/lib/tinycbor/src/cborpretty.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
#include <inttypes.h>
3737
#include <string.h>
3838

39+
#pragma GCC diagnostic push
40+
#pragma GCC diagnostic ignored "-Wpedantic"
41+
3942
/**
4043
* \defgroup CborPretty Converting CBOR to text
4144
* \brief Group of functions used to convert CBOR to text form.
@@ -575,4 +578,6 @@ CborError cbor_value_to_pretty_stream(CborStreamFunction streamFunction, void *t
575578
return value_to_pretty(streamFunction, token, value, flags, CBOR_PARSER_MAX_RECURSIONS);
576579
}
577580

581+
#pragma GCC diagnostic pop
582+
578583
/** @} */

0 commit comments

Comments
 (0)