Subject: pgAgent build warnings on Fedora 32

From: Devrim Gündüz <[email-masked]>
Date: Fri, 24 Apr 2020 13:21:42 +0100

Hi,

pgAgent throws the warnings below while compiling it on Fedora 32, which uses GCC 10. Can you please take a look?

Thanks! Devrim

===============================
 /usr/bin/make DESTDIR=/var/lib/pgsql/rpm12/BUILDROOT/pgagent_12-4.0.0-4.f32.x86_64 install
In file included from /var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/include/pgAgent.h:36,
                 from /var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/connection.cpp:12:
/var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/include/connection.h: In constructor 'DBconn::DBconn(const wstring&)':
/var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/include/connection.h:117:19: warning: 'DBconn::m_inUse' will be initialized after [-Wreorder]
  117 |  bool             m_inUse;
      |                   ^~~~~~~
/var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/include/connection.h:113:19: warning:   'DBconn* DBconn::m_next' [-Wreorder]
  113 |  DBconn          *m_next;
      |                   ^~~~~~
/var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/connection.cpp:21:1: warning:   when initialized here [-Wreorder]
   21 | DBconn::DBconn(const std::wstring &connectString)
      | ^~~~~~
In file included from /var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/include/pgAgent.h:36,
                 from /var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/connection.cpp:12:
/var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/include/connection.h:114:19: warning: 'DBconn::m_prev' will be initialized after [-Wreorder]
  114 |  DBconn          *m_prev;
      |                   ^~~~~~
/var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/include/connection.h:102:19: warning:   'int DBconn::m_minorVersion' [-Wreorder]
  102 |  int              m_minorVersion,
      |                   ^~~~~~~~~~~~~~
/var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/connection.cpp:21:1: warning:   when initialized here [-Wreorder]
   21 | DBconn::DBconn(const std::wstring &connectString)
      | ^~~~~~
/var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/connection.cpp: In member function 'std::wstring DBconn::ExecuteScalar(const wstring&)':
/var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/connection.cpp:333:6: warning: variable 'rows' set but not used [-Wunused-but-set-variable]
  333 |  int rows = -1;
      |      ^~~~
/var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/job.cpp: In member function 'int Job::Execute()':
/var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/job.cpp:157:9: warning: unused variable 'last_n_char' [-Wunused-variable]
  157 |     int last_n_char = 7;
      |         ^~~~~~~~~~~

-- 
Devrim Gündüz
Open Source Solution Architect, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

---

From: Neel Patel <[email-masked]>
Date: Fri, 24 Apr 2020 18:15:03 +0530

I will look into it.

On Fri, Apr 24, 2020 at 5:51 PM Devrim Gündüz <[email-masked]> wrote:

>  /usr/bin/make
> DESTDIR=/var/lib/pgsql/rpm12/BUILDROOT/pgagent_12-4.0.0-4.f32.x86_64 install
> In file included from
> /var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/include/pgAgent.h:36,
>                  from
> /var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/connection.cpp:12:
> /var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/include/connection.h: In
> constructor 'DBconn::DBconn(const wstring&)':
> /var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/include/connection.h:117:19:
> warning: 'DBconn::m_inUse' will be initialized after [-Wreorder]
>   117 |  bool             m_inUse;
>       |                   ^~~~~~~
> /var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/include/connection.h:113:19:
> warning:   'DBconn* DBconn::m_next' [-Wreorder]
>   113 |  DBconn          *m_next;
>       |                   ^~~~~~
> /var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/connection.cpp:21:1:
> warning:   when initialized here [-Wreorder]
> In file included from
> /var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/include/pgAgent.h:36,
>                  from
> /var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/connection.cpp:12:
> /var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/include/connection.h:114:19:
> warning: 'DBconn::m_prev' will be initialized after [-Wreorder]
>   114 |  DBconn          *m_prev;
>       |                   ^~~~~~
> /var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/include/connection.h:102:19:
> warning:   'int DBconn::m_minorVersion' [-Wreorder]
> /var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/connection.cpp:21:1:
> warning:   when initialized here [-Wreorder]
> /var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/connection.cpp: In member
> function 'std::wstring DBconn::ExecuteScalar(const wstring&)':
> /var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/connection.cpp:333:6:
> warning: variable 'rows' set but not used [-Wunused-but-set-variable]
>   333 |  int rows = -1;
>       |      ^~~~
> /var/lib/pgsql/rpm12/BUILD/pgAgent-4.0.0-Source/job.cpp:157:9: warning:
> unused variable 'last_n_char' [-Wunused-variable]

---

From: Devrim Gündüz <[email-masked]>
Date: Wed, 09 Sep 2020 15:09:26 +0100

Hi Neel,

> I will look into it.

Any updates?

Cheers,

---

From: Neel Patel <[email-masked]>
Date: Thu, 10 Sep 2020 10:58:58 +0530

Hi Devrim,

I have tried with gcc 10.1 on Ubuntu and I checked the logs but did not
find any warning. Below is my setup and logs during pgAgent compilation.
Is there any specific gcc 10.X version ? Let me know, I can set up and send
a patch.

#####################

neel@ubuntu:~/Projects/pgagent/build$ c++ --version
c++ (Ubuntu 10.1.0-2ubuntu1~18.04) 10.1.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

neel@ubuntu:~/Projects/pgagent/build$ g++ --version
g++ (Ubuntu 10.1.0-2ubuntu1~18.04) 10.1.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

neel@ubuntu:~/Projects/pgagent/build$ gcc --version
gcc (Ubuntu 10.1.0-2ubuntu1~18.04) 10.1.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

neel@ubuntu:~/Projects/pgagent/build$
PATH=/opt/PostgreSQL/10/bin:$PATH cmake ../ -DSTATIC_BUILD=NO
-DCMAKE_PREFIX_PATH=/home/neel/pgagent_install
-- The C compiler identification is GNU 10.1.0
-- The CXX compiler identification is GNU 10.1.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   filesystem
--   regex
--   date_time
--   thread
--   system
--   chrono
--   atomic
--
-- ================================================================================
-- Configuration summary:
--
--   Project                     : pgagent
--   Description                 : pgAgent is a job scheduling engine
for PostgreSQL
--   Version                     : 4.2.0
--
--   PostgreSQL version string   : PostgreSQL 10.11
--   PostgreSQL version parts    : 10
--   PostgreSQL path             : /opt/PostgreSQL/10
--   PostgreSQL config binary    : /opt/PostgreSQL/10/bin/pg_config
--   PostgreSQL include path     : /opt/PostgreSQL/10/include
--   PostgreSQL library path     : /opt/PostgreSQL/10/lib
--   PostgreSQL share path       : /opt/PostgreSQL/10/share/postgresql
--
--   Boost version               : 1.65.1
--   Boost path                  : /usr/include
--   Boost include directory     : /usr/include
--   Boost library directory     : /usr/lib/x86_64-linux-gnu
--   Boost Static linking        : NO
-- ================================================================================
--
-- Configuring done
-- Generating done
-- Build files have been written to:
/home/neel/Projects/pgagent/buildneel@ubuntu:~/Projects/pgagent/build$
make
Scanning dependencies of target run
[ 11%] Generating pgagent--4.2.sql, pgagent.control
[ 11%] Built target run
Scanning dependencies of target pgagent
[ 22%] Building CXX object CMakeFiles/pgagent.dir/connection.cpp.o
[ 33%] Building CXX object CMakeFiles/pgagent.dir/job.cpp.o
[ 44%] Building CXX object CMakeFiles/pgagent.dir/misc.cpp.o
[ 55%] Building CXX object CMakeFiles/pgagent.dir/pgAgent.cpp.o
[ 66%] Building CXX object CMakeFiles/pgagent.dir/precomp.cpp.o
[ 77%] Building CXX object CMakeFiles/pgagent.dir/unix.cpp.o
[ 88%] Building CXX object CMakeFiles/pgagent.dir/win32.cpp.o
[100%] Linking CXX executable pgagent
[100%] Built target pgagent

###############################################