eudev-project / eudev

Repository for eudev development
GNU General Public License v2.0
529 stars 144 forks source link

Compile error `no member named 'buf'` when building with `-DDEBUG=1` #287

Closed bence98 closed 2 months ago

bence98 commented 2 months ago

Compilation fails when -DDEBUG=1 is set:

make[5]: Entering directory '/home/br-user/buildroot/output/build/eudev-3.2.11/src/udev'
  CC       libudev_core_la-udev-rules.lo
udev-rules.c: In function ‘dump_token’:
udev-rules.c:328:29: warning: implicit declaration of function ‘str’ [-Wimplicit-function-declaration]
  328 |         const char *value = str(rules, token->key.value_off);
      |                             ^~~
udev-rules.c:328:29: warning: initialization of ‘const char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
udev-rules.c:329:34: error: ‘struct udev_rules’ has no member named ‘buf’
  329 |         const char *attr = &rules->buf[token->key.attr_off];
      |                                  ^~
In file included from ../../src/shared/macro.h:259,
                 from udev.h:26,
                 from udev-rules.c:33:
udev-rules.c:339:41: error: ‘struct udev_rules’ has no member named ‘buf’
  339 |                                   &rules->buf[token->rule.filename_off], token->rule.filename_line,
      |                                         ^~
../../src/shared/log.h:97:70: note: in definition of macro ‘log_full_errno’
   97 |                 ? log_internal(_l, _e, __FILE__, __LINE__, __func__, __VA_ARGS__) \
      |                                                                      ^~~~~~~~~~~
../../src/shared/log.h:104:28: note: in expansion of macro ‘log_full’
  104 | #define log_debug(...)     log_full(LOG_DEBUG,   __VA_ARGS__)
      |                            ^~~~~~~~
udev-rules.c:338:25: note: in expansion of macro ‘log_debug’
  338 |                         log_debug("* RULE %s:%u, token: %u, count: %u, label: '%s'",
      |                         ^~~~~~~~~
udev-rules.c:341:41: error: ‘struct udev_rules’ has no member named ‘buf’
  341 |                                   &rules->buf[token->rule.label_off]);
      |                                         ^~
../../src/shared/log.h:97:70: note: in definition of macro ‘log_full_errno’
   97 |                 ? log_internal(_l, _e, __FILE__, __LINE__, __func__, __VA_ARGS__) \
      |                                                                      ^~~~~~~~~~~
../../src/shared/log.h:104:28: note: in expansion of macro ‘log_full’
  104 | #define log_debug(...)     log_full(LOG_DEBUG,   __VA_ARGS__)
      |                            ^~~~~~~~
udev-rules.c:338:25: note: in expansion of macro ‘log_debug’
  338 |                         log_debug("* RULE %s:%u, token: %u, count: %u, label: '%s'",
      |                         ^~~~~~~~~
udev-rules.c: In function ‘dump_rules’:
udev-rules.c:441:24: error: ‘struct udev_rules’ has no member named ‘buf_count’
  441 |                   rules->buf_count,
      |                        ^~
../../src/shared/log.h:97:70: note: in definition of macro ‘log_full_errno’
   97 |                 ? log_internal(_l, _e, __FILE__, __LINE__, __func__, __VA_ARGS__) \
      |                                                                      ^~~~~~~~~~~
../../src/shared/log.h:104:28: note: in expansion of macro ‘log_full’
  104 | #define log_debug(...)     log_full(LOG_DEBUG,   __VA_ARGS__)
      |                            ^~~~~~~~
udev-rules.c:438:9: note: in expansion of macro ‘log_debug’
  438 |         log_debug("dumping %u (%zu bytes) tokens, %u (%zu bytes) strings",
      |         ^~~~~~~~~
udev-rules.c:442:24: error: ‘struct udev_rules’ has no member named ‘buf_cur’
  442 |                   rules->buf_cur);
      |                        ^~
../../src/shared/log.h:97:70: note: in definition of macro ‘log_full_errno’
   97 |                 ? log_internal(_l, _e, __FILE__, __LINE__, __func__, __VA_ARGS__) \
      |                                                                      ^~~~~~~~~~~
../../src/shared/log.h:104:28: note: in expansion of macro ‘log_full’
  104 | #define log_debug(...)     log_full(LOG_DEBUG,   __VA_ARGS__)
      |                            ^~~~~~~~
udev-rules.c:438:9: note: in expansion of macro ‘log_debug’
  438 |         log_debug("dumping %u (%zu bytes) tokens, %u (%zu bytes) strings",
      |         ^~~~~~~~~
Makefile:767: recipe for target 'libudev_core_la-udev-rules.lo' failed

The bug was introduced here: Link: https://github.com/eudev-project/eudev/commit/915bf0f60fa77ffc2e7e229fff8fdc262912f912#diff-86375330bab0167b9f8af6a38146b74a92fbc0ead8936f79ae9295422bda1de2L327