Skip to content

Small changes (docs plus assert) #1795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions hal/api/CThunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__

Expand Down
2 changes: 1 addition & 1 deletion hal/api/DirHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class DirHandle {
*
* @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() {}
};
Expand Down
8 changes: 4 additions & 4 deletions hal/api/FileSystemLike.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class FileSystemLike : public FileBase {
* @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.
*
Expand All @@ -72,7 +72,7 @@ class FileSystemLike : public FileBase {
* 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.
Expand All @@ -83,7 +83,7 @@ class FileSystemLike : public FileBase {
* 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.
*
Expand All @@ -94,7 +94,7 @@ class FileSystemLike : public FileBase {
* 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)
};
Expand Down
1 change: 1 addition & 0 deletions hal/api/mbed.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 12 additions & 2 deletions hal/common/assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,19 @@
* limitations under the License.
*/
#include "mbed_assert.h"
#include "mbed_error.h"
#include "device.h"

#if DEVICE_STDIO_MESSAGES
#include <stdio.h>
#endif

#include <stdlib.h>
#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();
}