From d898c11e428f3193eca33c9638efeb377ccd9f60 Mon Sep 17 00:00:00 2001 From: 0xc0170 Date: Thu, 26 May 2016 15:07:57 +0100 Subject: [PATCH 1/2] api - doxygen improvements, unused parameters fixes This patch is taken from mbed-drivers master. --- hal/api/CThunk.h | 9 +++++++++ hal/api/DirHandle.h | 2 +- hal/api/FileSystemLike.h | 8 ++++---- hal/api/mbed.h | 1 + 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/hal/api/CThunk.h b/hal/api/CThunk.h index aadd6781a2..741bf9c7c3 100644 --- a/hal/api/CThunk.h +++ b/hal/api/CThunk.h @@ -19,6 +19,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +/* General C++ Object Thunking class + * + * - allows direct callbacks to non-static C++ class functions + * - keeps track for the corresponding class instance + * - supports an optional context parameter for the called function + * - ideally suited for class object receiving interrupts (NVIC_SetVector) + */ + #ifndef __CTHUNK_H__ #define __CTHUNK_H__ diff --git a/hal/api/DirHandle.h b/hal/api/DirHandle.h index 329f4d1c71..f163010153 100644 --- a/hal/api/DirHandle.h +++ b/hal/api/DirHandle.h @@ -82,7 +82,7 @@ public: * * @param location The location to seek to. Must be a value returned by telldir. */ - virtual void seekdir(off_t location) { } + virtual void seekdir(off_t location) { (void)location;} virtual ~DirHandle() {} }; diff --git a/hal/api/FileSystemLike.h b/hal/api/FileSystemLike.h index 6680c4cb01..926330c20c 100644 --- a/hal/api/FileSystemLike.h +++ b/hal/api/FileSystemLike.h @@ -61,7 +61,7 @@ public: * @param filename the name of the file to remove. * @param returns 0 on success, -1 on failure. */ - virtual int remove(const char *filename) { return -1; }; + virtual int remove(const char *filename) { (void) filename; return -1; }; /** Rename a file in the filesystem. * @@ -72,7 +72,7 @@ public: * 0 on success, * -1 on failure. */ - virtual int rename(const char *oldname, const char *newname) { return -1; }; + virtual int rename(const char *oldname, const char *newname) { (void) oldname, (void) newname; return -1; }; /** Opens a directory in the filesystem and returns a DirHandle * representing the directory stream. @@ -83,7 +83,7 @@ public: * A DirHandle representing the directory stream, or * NULL on failure. */ - virtual DirHandle *opendir(const char *name) { return NULL; }; + virtual DirHandle *opendir(const char *name) { (void) name; return NULL; }; /** Creates a directory in the filesystem. * @@ -94,7 +94,7 @@ public: * 0 on success, * -1 on failure. */ - virtual int mkdir(const char *name, mode_t mode) { return -1; } + virtual int mkdir(const char *name, mode_t mode) { (void) name, (void) mode; return -1; } // TODO other filesystem functions (mkdir, rm, rn, ls etc) }; diff --git a/hal/api/mbed.h b/hal/api/mbed.h index a5fbb4c9bc..d28b20a0c7 100644 --- a/hal/api/mbed.h +++ b/hal/api/mbed.h @@ -27,6 +27,7 @@ // mbed Debug libraries #include "mbed_error.h" #include "mbed_interface.h" +#include "mbed_assert.h" // mbed Peripheral components #include "DigitalIn.h" From 985255dbb5ad6c1b962ee6b2519f6e01884d650f Mon Sep 17 00:00:00 2001 From: 0xc0170 Date: Thu, 26 May 2016 15:36:32 +0100 Subject: [PATCH 2/2] assert - use fprintf (if serial=1) and mbed_die --- hal/common/assert.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hal/common/assert.c b/hal/common/assert.c index 3d2097ce02..51394707b0 100644 --- a/hal/common/assert.c +++ b/hal/common/assert.c @@ -14,9 +14,19 @@ * limitations under the License. */ #include "mbed_assert.h" -#include "mbed_error.h" +#include "device.h" + +#if DEVICE_STDIO_MESSAGES +#include +#endif + +#include +#include "mbed_interface.h" void mbed_assert_internal(const char *expr, const char *file, int line) { - error("mbed assertation failed: %s, file: %s, line %d \n", expr, file, line); +#if DEVICE_STDIO_MESSAGES + fprintf(stderr, "mbed assertation failed: %s, file: %s, line %d \n", expr, file, line); +#endif + mbed_die(); }