pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andy Fan <zhihuifan1213@163.com>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Japin Li <japinli@hotmail.com>
Cc: Jim Jones <jim.jones@uni-muenster.de>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: New function normal_rand_array function to contrib/tablefunc.
Date: Sat, 26 Oct 2024 08:51:09 +0800
Message-ID: <87zfmru1oi.fsf@163.com> (raw)
In-Reply-To: <CAEZATCXZt1sUuT4SdZo5vn1rJtm2Rp3UCUsH2YzyBt-vHRXrrQ@mail.gmail.com>
References: <87plssezpc.fsf@163.com>
	<fd1de8c0-467b-4a41-8f7b-0d5122676ecb@uni-muenster.de>
	<CAEZATCX_Rd24mS4ScEYV=cLKMoQEJX=+oq40kYbok8rw211W8g@mail.gmail.com>
	<87v814wmz0.fsf@163.com>
	<CAEZATCUMvnFMiYJbDvk4d1nDdZ8VEqZWOjTUUZZ3itowGyB42w@mail.gmail.com>
	<87plpv1rb0.fsf@163.com>
	<87le0iqrsu.fsf@163.com>
	<ME0P300MB04456793A234B3B1A2B77882B6942@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM>
	<87zfox2rx7.fsf@163.com>
	<ME0P300MB044589098B6FB20AA771C97DB6952@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM>
	<87ed68gcym.fsf@163.com>
	<CAEZATCXZt1sUuT4SdZo5vn1rJtm2Rp3UCUsH2YzyBt-vHRXrrQ@mail.gmail.com>


> 10). In this error:
>
> +        elog(ERROR, "unsupported type %d for rand_array function.",
> +             datatype);
>
> "datatype" is of type Oid, which is unsigned, and so it should use
> "%u" not "%d". Also, as above, it should not end with a period, so it
> should be:
>
> +        elog(ERROR, "unsupported type %u for rand_array function",
> +             datatype);

I remember my IDE could detect such issue before, but failed this
time. I just checked more today and it is still failing. Looks the
checker is not stable and I can't find out the reason so far.

main.c

#include <stdio.h>

int main(int argc, char *argv[])
{
    unsigned int i = 0;
    int x = 2;
    printf("i = %d\n", i);
    printf("i = %u\n", x);    
    return 0;
}

All the following commands succeed without any warnings.

clang -O0 -g main.c -o main -Wall -Wformat
gcc -g main.c -o main -Wall -Wformat

scan-build clang -g main.c -o main -Wall -Wformat
cppcheck main.c

clang: 18.1.6
gcc: 13.3.0

Only "cppcheck --enable=all main.c" catch the warnning.

Any hints on this will be appreicated.

-- 
Best Regards
Andy Fan






view thread (30+ messages)  latest in thread

Message-ID: <87zfmru1oi.fsf@163.com>
Permalink:  ../87zfmru1oi.fsf@163.com/
Also on:    postgresql.org/message-id/87zfmru1oi.fsf@163.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: zhihuifan1213@163.com, dean.a.rasheed@gmail.com, japinli@hotmail.com, jim.jones@uni-muenster.de, pgsql-hackers@lists.postgresql.org
  Subject: Re: New function normal_rand_array function to contrib/tablefunc.
  In-Reply-To: <87zfmru1oi.fsf@163.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox