Giter Site home page Giter Site logo

禁止输出时编译错误 about easylogger HOT 5 CLOSED

armink avatar armink commented on May 12, 2024
禁止输出时编译错误

from easylogger.

Comments (5)

armink avatar armink commented on May 12, 2024

刚修正了,你再试试,多谢反馈哈~

from easylogger.

mojinpan avatar mojinpan commented on May 12, 2024

应该是把elog.h中elog_a~elog_v的宏定义默认给出了有效定义(187-192行),移至78行#else /* ELOG_OUTPUT_ENABLE /的后面:如下:
……
#ifndef ELOG_OUTPUT_ENABLE
#define elog_a(tag, ...)
#define elog_e(tag, ...)
#define elog_w(tag, ...)
#define elog_i(tag, ...)
#define elog_d(tag, ...)
#define elog_v(tag, ...)
#else /
ELOG_OUTPUT_ENABLE */
#define elog_a(tag, ...) elog_assert(tag, VA_ARGS)
#define elog_e(tag, ...) elog_error(tag, VA_ARGS)
#define elog_w(tag, ...) elog_warn(tag, VA_ARGS)
#define elog_i(tag, ...) elog_info(tag, VA_ARGS)
#define elog_d(tag, ...) elog_debug(tag, VA_ARGS)
#define elog_v(tag, ...) elog_verbose(tag, VA_ARGS)
……

from easylogger.

armink avatar armink commented on May 12, 2024

都行的,之前这个位置的定义写错了,所以修正下就行了

#ifndef ELOG_OUTPUT_ENABLE
#define elog_a(tag, ...)
#define elog_e(tag, ...)
#define elog_w(tag, ...)
#define elog_i(tag, ...)
#define elog_d(tag, ...)
#define elog_v(tag, ...)
#else /* ELOG_OUTPUT_ENABLE */

from easylogger.

mojinpan avatar mojinpan commented on May 12, 2024

实际上是不行的,原文结构如下;

……
#ifndef ELOG_OUTPUT_ENABLE
    #define elog_a(tag, ...)
    #define elog_e(tag, ...)
    #define elog_w(tag, ...)
    #define elog_i(tag, ...)
    #define elog_d(tag, ...)
    #define elog_v(tag, ...)
#else /* ELOG_OUTPUT_ENABLE */
……
#endif /* ELOG_OUTPUT_ENABLE */
……
#define elog_a(tag, ...)     elog_assert(tag, __VA_ARGS__)
#define elog_e(tag, ...)     elog_error(tag, __VA_ARGS__)
#define elog_w(tag, ...)     elog_warn(tag, __VA_ARGS__)
#define elog_i(tag, ...)     elog_info(tag, __VA_ARGS__)
#define elog_d(tag, ...)     elog_debug(tag, __VA_ARGS__)
#define elog_v(tag, ...)     elog_verbose(tag, __VA_ARGS__)
……

无论#ifndef ELOG_OUTPUT_ENABLE 是否生效,最后面的elog_a~elog_v的定义均生效,导致错误,这部分内容必须放到:

#else /* ELOG_OUTPUT_ENABLE */
……
#endif /* ELOG_OUTPUT_ENABLE */

from easylogger.

armink avatar armink commented on May 12, 2024

你可以更新下来试试嘛,我这边测试没问题

改动位于:6734e93

from easylogger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.