public inbox for [email protected]  
help / color / mirror / Atom feed
From: Hayato Kuroda (Fujitsu) <[email protected]>
To: 'Peter Eisentraut' <[email protected]>
To: Michael Meskes <[email protected]>
Cc: [email protected] <[email protected]>
Subject: RE: MinGW compiler warnings in ecpg tests
Date: Fri, 10 Nov 2023 07:59:49 +0000
Message-ID: <TYAPR01MB5866A71B744BE01B3BF71791F5AEA@TYAPR01MB5866.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>

Dear Peter, Michael,

Sorry for reviving the old thread. While trying to build postgres on msys2 by meson,
I faced the same warning. The OS is Windows 10.

```
$ ninja
[2378/2402] Compiling C object src/interfaces/ecpg/test/sql/sqlda.exe.p/meson-generated_.._sqlda.c.obj
../postgres/src/interfaces/ecpg/test/sql/sqlda.pgc: In function 'dump_sqlda':
../postgres/src/interfaces/ecpg/test/sql/sqlda.pgc:45:33: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long long int' [-Wformat=]
   45 |                                 "name sqlda descriptor: '%s' value %I64d\n",
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
   49 |                                 sqlda->sqlvar[i].sqlname.data, *(long long int *)sqlda->sqlvar[i].sqldata);
      |                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                |
      |                                                                long long int
```


Before building, I did below steps:

1. Installed required software listed in [1].
2. ran `meson setup -Dcassert=true -Ddebug=true /path/to/builddir`
3. moved to /path/to/builddir
4. ran `ninja`
5. got above warning

Attached file summarize the result of meson command, which was output at the end of it.
Also, belows show the version of meson/ninja.

```
$ ninja --version
1.11.1
$ meson -v
1.2.3
```

I was quite not sure the windows build, but I could see that gcc compiler was
used here. Does it mean that the compiler might not like the format string "%I64d"?
I modified like below and could be compiled without warnings.

```
--- a/src/interfaces/ecpg/test/sql/sqlda.pgc
+++ b/src/interfaces/ecpg/test/sql/sqlda.pgc
@@ -41,7 +41,7 @@ dump_sqlda(sqlda_t *sqlda)
                        break;
                case ECPGt_long_long:
                        printf(
-#ifdef _WIN32
+#if !defined(__GNUC__)
                                "name sqlda descriptor: '%s' value %I64d\n",
 #else
                                "name sqlda descriptor: '%s' value %lld\n",

```

[1]: https://www.postgresql.org/message-id/9f4f22be-f9f1-b350-bc06-521226b87f7a%40dunslane.net

Best Regards,
Hayato Kuroda
FUJITSU LIMITED


postgresql 17devel

  Data layout
    data block size        : 8 kB
    WAL block size         : 8 kB
    segment size           : 1 GB

  System
    host system            : windows x86_64
    build system           : windows x86_64

  Compiler
    linker                 : ld.bfd
    C compiler             : gcc 13.2.0

  Compiler Flags
    CPP FLAGS              :
    C FLAGS, functional    : -fno-strict-aliasing -fwrapv -fexcess-precision=standard
    C FLAGS, warnings      : -Wmissing-prototypes -Wpointer-arith -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wforma
t-security -Wdeclaration-after-statement -Wno-format-truncation -Wno-stringop-truncation
    C FLAGS, modules       : -fvisibility=hidden
    C FLAGS, user specified:
    LD FLAGS               : -Wl,--stack,4194304 -Wl,--allow-multiple-definition -Wl,--disable-auto-import

  Programs
    bison                  : C:\msys64\usr\bin/bison.EXE 3.8.2
    dtrace                 : NO
    flex                   : C:\msys64\usr\bin/flex.EXE 2.6.4

  External libraries
    bonjour                : NO
    bsd_auth               : NO
    docs                   : YES
    docs_pdf               : NO
    gss                    : NO
    icu                    : NO
    ldap                   : YES
    libxml                 : NO
    libxslt                : NO
    llvm                   : NO
    lz4                    : NO
    nls                    : YES
    openssl                : YES 3.1.4
    pam                    : NO
    plperl                 : NO
    plpython               : NO
    pltcl                  : YES 8.6.12
    readline               : YES
    selinux                : NO
    systemd                : NO
    uuid                   : NO
    zlib                   : YES 1.3
    zstd                   : YES 1.5.5

  User defined options
    debug                  : true
    cassert                : true

Found ninja-1.11.1 at C:\msys64\mingw64\bin/ninja.EXE


Attachments:

  [text/plain] meson_setup.txt (2.0K, ../TYAPR01MB5866A71B744BE01B3BF71791F5AEA@TYAPR01MB5866.jpnprd01.prod.outlook.com/2-meson_setup.txt)
  download | inline:
postgresql 17devel

  Data layout
    data block size        : 8 kB
    WAL block size         : 8 kB
    segment size           : 1 GB

  System
    host system            : windows x86_64
    build system           : windows x86_64

  Compiler
    linker                 : ld.bfd
    C compiler             : gcc 13.2.0

  Compiler Flags
    CPP FLAGS              :
    C FLAGS, functional    : -fno-strict-aliasing -fwrapv -fexcess-precision=standard
    C FLAGS, warnings      : -Wmissing-prototypes -Wpointer-arith -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wforma
t-security -Wdeclaration-after-statement -Wno-format-truncation -Wno-stringop-truncation
    C FLAGS, modules       : -fvisibility=hidden
    C FLAGS, user specified:
    LD FLAGS               : -Wl,--stack,4194304 -Wl,--allow-multiple-definition -Wl,--disable-auto-import

  Programs
    bison                  : C:\msys64\usr\bin/bison.EXE 3.8.2
    dtrace                 : NO
    flex                   : C:\msys64\usr\bin/flex.EXE 2.6.4

  External libraries
    bonjour                : NO
    bsd_auth               : NO
    docs                   : YES
    docs_pdf               : NO
    gss                    : NO
    icu                    : NO
    ldap                   : YES
    libxml                 : NO
    libxslt                : NO
    llvm                   : NO
    lz4                    : NO
    nls                    : YES
    openssl                : YES 3.1.4
    pam                    : NO
    plperl                 : NO
    plpython               : NO
    pltcl                  : YES 8.6.12
    readline               : YES
    selinux                : NO
    systemd                : NO
    uuid                   : NO
    zlib                   : YES 1.3
    zstd                   : YES 1.5.5

  User defined options
    debug                  : true
    cassert                : true

Found ninja-1.11.1 at C:\msys64\mingw64\bin/ninja.EXE

view thread (7+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: RE: MinGW compiler warnings in ecpg tests
  In-Reply-To: <TYAPR01MB5866A71B744BE01B3BF71791F5AEA@TYAPR01MB5866.jpnprd01.prod.outlook.com>

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

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