Re: bug in sanei_debug.h

From: Henning Meier-Geinitz (hmg-ml@gmx.de)
Date: Sun Oct 15 2000 - 12:44:13 PDT

  • Next message: Henning Meier-Geinitz: "Re: SANE can't see Epson Perfection 1200S"

    Hi,

    On Sun, Oct 15, 2000 at 08:13:32PM +0200, Jochen Eisinger wrote:
    > There's another bug in sanei_debug.h: before we test what value __GNUC__
    > has, we should test, whether __GNUC__ is defined at all.

    I'm not sure but I think this was done intentionally. The code is:

    #if __GNUC__ - 0 > 2 || (__GNUC__ - 0 == 2 && __GNUC_MINOR__ > 5)

    With __GNUC__ undefined this will expand to

    #if 0 - 0 > 2 || (0 - 0 == 2 && 0 > 5)

    (At least this is what the gnu cpp manual says, I hope this is true for
    other preprocessors).

    I don't know why the code uses __GNUC__ - 0, maybe this is when __GNUC__ is
    defined but empty?

    But you are right that

    #ifdef __GNUC__
    # if __GNUC__ ...

    is easier to understand and maybe more portable (I haven't heard of problems
    on any platform about this line, however). So I think you can change this.

    > I had a look at it. I thought, we could define DBG like this
    >
    > #define DBG sanei_debug_set(DBG_LEVEL, STRINGIFY(BACKEND_NAME));
    > sanei_debug

    This was my first idea, too.

    > but this fails on code like this
    >
    > if (...)
    > DBG(...)
    > else
    > ...

    Exactly. Probably other persons thought about this problem years ago with no
    result ...

    Bye,
      Henning

    --
    Source code, list archive, and docs: http://www.mostang.com/sane/
    To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com
    



    This archive was generated by hypermail 2b29 : Tue Oct 17 2000 - 11:47:26 PDT