include: improve compatibility with C++ apps.

This patch lets a C++ application use more of Zephyr by adding guards
and changeing some constructs to the C++11 equivalent.

Changes include:

- Adding guards
- Switching to static_assert
- Switching to a template for ARRAY_SIZE as g++ doesn't have the
  builtin.
- Re-ordering designated initialisers to match the struct field order
  as G++ only supports simple designated initialisers.

Signed-off-by: Michael Hope <mlhx@google.com>
This commit is contained in:
Michael Hope 2018-03-17 12:44:40 +01:00 committed by Anas Nashif
commit 5f67a6119d
13 changed files with 135 additions and 59 deletions

View file

@ -216,7 +216,7 @@ struct device;
* @param config_info address of driver instance config information
*/
struct device_config {
char *name;
const char *name;
int (*init)(struct device *device);
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
int (*device_pm_control)(struct device *device, u32_t command,