Re: Small miscellaneus fixes (Part II)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Small miscellaneus fixes (Part II)
Date: 2022-12-22 17:29:11
Message-ID: CAEudQAq_1BfRhq6H6DHR_KAxYcnFjXKuWVuL7cDaBPKPtEf+4g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em ter., 20 de dez. de 2022 às 21:51, Justin Pryzby <pryzby(at)telsasoft(dot)com>
escreveu:

> On Fri, Nov 25, 2022 at 06:27:04PM -0300, Ranier Vilela wrote:
> > 5. Use boolean operator with boolean operands
> > (b/src/backend/commands/tablecmds.c)
>
> tablecmds.c: right. Since 074c5cfbf
>
> pg_dump.c: right. Since b08dee24a
>
> > 4. Fix dead code (src/backend/utils/adt/formatting.c)
> > Np->sign == '+', is different than "!= '-'" and is different than "!=
> '+'"
> > So the else is never hit.
>
> formatting.c: I don't see the problem.
>
> if (Np->sign != '-')
> ...
> else if (Np->sign != '+' && IS_PLUS(Np->Num))
> ...
>
> You said that the "else" is never hit, but why ?
>
This is a Coverity report.

dead_error_condition: The condition Np->Num->flag & 0x200 cannot be true.
5671 else if (Np->sign != '+' && IS_PLUS(Np->Num))

CID 1501076 (#1 of 1): Logically dead code (DEADCODE)dead_error_line: Execution
cannot reach this statement: Np->Num->flag &= 0xffffffff....

So, the dead code is because IS_PUS(Np->Num) is already tested and cannot
be true on else.

v1 patch attached.

regards,
Ranier Vilela

Attachment Content-Type Size
v1-fix_dead_code_formatting.patch application/octet-stream 550 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Eric Radman 2022-12-22 17:41:24 Re: [PATCH] Add function to_oct
Previous Message Justin Pryzby 2022-12-22 17:08:59 Re: Add LZ4 compression in pg_dump