Skip to content

-Wundef warning #40

Description

@simark

When building with -Wundef, we get this diagnostic

$ cmake .. -DCMAKE_C_FLAGS="-Wundef"
-- Configuring done
-- Generating done
-- Build files have been written to: /home/smarchi/src/zf_log/build
$ make
[ 50%] Building C object zf_log/CMakeFiles/zf_log.dir/zf_log.c.o
/home/smarchi/src/zf_log/zf_log/zf_log.c: In function ‘put_tag’:
/home/smarchi/src/zf_log/zf_log/zf_log.c:452:15: error: "_ZF_LOG_MESSAGE_FORMAT_MASK__TAG" is not defined, evaluates to 0 [-Werror=undef]
  _PP_CONCAT_3(_ZF_LOG_MESSAGE_FORMAT_MASK_, _, field)
               ^
/home/smarchi/src/zf_log/zf_log/zf_log.c:347:30: note: in definition of macro ‘_PP_PASTE_3’
 #define _PP_PASTE_3(a, b, c) a ## b ## c
                              ^
/home/smarchi/src/zf_log/zf_log/zf_log.c:452:2: note: in expansion of macro ‘_PP_CONCAT_3’
  _PP_CONCAT_3(_ZF_LOG_MESSAGE_FORMAT_MASK_, _, field)
  ^~~~~~~~~~~~
/home/smarchi/src/zf_log/zf_log/zf_log.c:467:3: note: in expansion of macro ‘_ZF_LOG_MESSAGE_FORMAT_MASK’
  (_ZF_LOG_MESSAGE_FORMAT_MASK(field) & _ZF_LOG_MESSAGE_FORMAT_FIELDS(format))
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/smarchi/src/zf_log/zf_log/zf_log.c:1159:6: note: in expansion of macro ‘_ZF_LOG_MESSAGE_FORMAT_CONTAINS’
 #if !_ZF_LOG_MESSAGE_FORMAT_CONTAINS(TAG, ZF_LOG_MESSAGE_TAG_FORMAT)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I tried to investigate but quickly got lost in the macros. I believe that it might be important, as some value that's supposed to be a mask is actually 0.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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