Skip to content

Undefined configuration and compiler definitions cause warnings #12

@rikvdh

Description

@rikvdh

Hi Nicholas,

I was compiling Mpack for a non-Linux platform today (non-GNU) and ran into a big list of warnings (46 to be exact). Since we want to compile our code with -Werror we really want to fix it. But we need your opinion on this.

See some of our warnings below this. We are using the amalgamation package, so line-numbers are crazy, but you will get the point. The compiler moans about the check within #if while the variable is not defined.

In the example of the first warning:

#if MPACK_STDLIB

should become:

#if defined(MPACK_STDLIB) && MPACK_STDLIB

but this creates a mess in the code. From my point of view, you want to use:

#ifdef MPACK_STDLIB

or

#if defined(MPACK_STDLIB)

but this changes the behavior when configuring Mpack, only setting config to 0 wouldn't suffice. You need to disable the config option completely.

We are using GCC 4.9.3 Linaro arm-none-eabi cross-tools.

I can fix this and make a PR for you. But (since it is your lib) I need your input on this.

Thanks,

Rik

/3rdparty/mpack/src/mpack/mpack.h:78:5: warning: "MPACK_STDLIB" is not defined [-Wundef]
 #if MPACK_STDLIB
     ^
/3rdparty/mpack/src/mpack/mpack.h:82:5: warning: "MPACK_STDIO" is not defined [-Wundef]
 #if MPACK_STDIO
     ^
/3rdparty/mpack/src/mpack/mpack.h:85:5: warning: "MPACK_SETJMP" is not defined [-Wundef]
 #if MPACK_SETJMP
     ^
/3rdparty/mpack/src/mpack/mpack.h:113:7: warning: "_MSC_VER" is not defined [-Wundef]
 #elif _MSC_VER
       ^
/3rdparty/mpack/src/mpack/mpack.h:192:5: warning: "MPACK_STDLIB" is not defined [-Wundef]
 #if MPACK_STDLIB
     ^
/3rdparty/mpack/src/mpack/mpack.h:224:5: warning: "MPACK_READ_TRACKING" is not defined [-Wundef]
 #if MPACK_READ_TRACKING && (!defined(MPACK_READER) || !MPACK_READER)
     ^
/3rdparty/mpack/src/mpack/mpack.h:227:5: warning: "MPACK_WRITE_TRACKING" is not defined [-Wundef]
 #if MPACK_WRITE_TRACKING && (!defined(MPACK_WRITER) || !MPACK_WRITER)
     ^
/3rdparty/mpack/src/mpack/mpack.h:231:9: warning: "MPACK_STDIO" is not defined [-Wundef]
     #if MPACK_STDIO
         ^
/3rdparty/mpack/src/mpack/mpack.h:234:9: warning: "MPACK_READ_TRACKING" is not defined [-Wundef]
     #if MPACK_READ_TRACKING
         ^
/3rdparty/mpack/src/mpack/mpack.h:237:9: warning: "MPACK_WRITE_TRACKING" is not defined [-Wundef]
     #if MPACK_WRITE_TRACKING
         ^
/3rdparty/mpack/src/mpack/mpack.h:559:5: warning: "MPACK_READ_TRACKING" is not defined [-Wundef]
 #if MPACK_READ_TRACKING || MPACK_WRITE_TRACKING
     ^
/3rdparty/mpack/src/mpack/mpack.h:559:28: warning: "MPACK_WRITE_TRACKING" is not defined [-Wundef]
 #if MPACK_READ_TRACKING || MPACK_WRITE_TRACKING
                            ^
/3rdparty/mpack/src/mpack/mpack.h:780:5: warning: "MPACK_WRITE_TRACKING" is not defined [-Wundef]
 #if MPACK_WRITE_TRACKING
     ^
/3rdparty/mpack/src/mpack/mpack.h:827:9: warning: "MPACK_SETJMP" is not defined [-Wundef]
     #if MPACK_SETJMP
         ^
/3rdparty/mpack/src/mpack/mpack.h:833:9: warning: "MPACK_WRITE_TRACKING" is not defined [-Wundef]
     #if MPACK_WRITE_TRACKING
         ^
/3rdparty/mpack/src/mpack/mpack.h:882:5: warning: "MPACK_STDIO" is not defined [-Wundef]
 #if MPACK_STDIO
     ^
/3rdparty/mpack/src/mpack/mpack.h:906:5: warning: "MPACK_SETJMP" is not defined [-Wundef]
 #if MPACK_SETJMP
     ^
/3rdparty/mpack/src/mpack/mpack.h:1203:5: warning: "MPACK_WRITE_TRACKING" is not defined [-Wundef]
 #if MPACK_WRITE_TRACKING
     ^
/3rdparty/mpack/src/mpack/mpack.h:1298:5: warning: "MPACK_READ_TRACKING" is not defined [-Wundef]
 #if MPACK_READ_TRACKING
     ^
/3rdparty/mpack/src/mpack/mpack.h:1351:9: warning: "MPACK_SETJMP" is not defined [-Wundef]
     #if MPACK_SETJMP

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions