Files
odfstudio/solenv/Executable_concat-deps.mk
Michael Weghorn c454227699 solenv concat-deps: Convert from C to C++
Convert concat-deps.c from C to C++:

* rename file suffix from ".c" to ".cxx"
* adjust Makefile to build as a C++ program
* adjust C-style casts to C++ casts and use nullptr
  instead of   NULL to address clang plugin warnings
  otherwise showing up after the conversion

Otherwise, leave the source/logic unchanged. Further
simplification of the program using newly available C++
features would probably be possible now (e.g. looking into
replacing the custom hash logic by a preexisting C++ stdlib
class) be possible, but is outside the scope of this commit.

The original trigger for looking into this initial
conversion from C to C++ was to avoid loplugin:pointerbool and
loplugin:implicitboolconversion clang plugin warnings newly
showing up with the original C sources after upgarding
glibc packages on Debian testing from 2.42-17 to 2.43-3:

    [C  ] solenv/bin/concat-deps.c
    /home/michi/development/git/libreoffice/solenv/bin/concat-deps.c:175:22: error: possibly unwanted implicit conversion when calling bool param [loplugin:pointerbool]
      175 |         assert(pool->primary);
          |                ~~~~~~^~~~~~~
    /usr/include/assert.h:157:42: note: expanded from macro 'assert'
      157 |     ((void) sizeof (__assert_single_arg (__VA_ARGS__)), __extension__ ({ \
          |                                          ^~~~~~~~~~~
    /usr/include/assert.h:117:40: note: method here [loplugin:pointerbool]
      117 | extern _Bool __assert_single_arg (_Bool);
          |                                   ~~~~~^
    /home/michi/development/git/libreoffice/solenv/bin/concat-deps.c:1113:12: error: possibly unwanted implicit conversion when calling bool param [loplugin:pointerbool]
     1113 |     assert(phony_content_buffer); // Don't handle OOM conditions
          |            ^~~~~~~~~~~~~~~~~~~~
    /usr/include/assert.h:117:40: note: method here [loplugin:pointerbool]
      117 | extern _Bool __assert_single_arg (_Bool);
          |                                   ~~~~~^
    /home/michi/development/git/libreoffice/solenv/bin/concat-deps.c:175:16: error: implicit conversion (IntegralToBoolean) of call argument from 'int' to 'bool' [loplugin:implicitboolconversion]
      175 |         assert(pool->primary);
          |                ^~~~~~~~~~~~~
    /usr/include/assert.h:157:42: note: expanded from macro 'assert'
      157 |     ((void) sizeof (__assert_single_arg (__VA_ARGS__)), __extension__ ({ \
          |                                          ^~~~~~~~~~~
    /home/michi/development/git/libreoffice/solenv/bin/concat-deps.c:209:12: error: implicit conversion (IntegralToBoolean) of call argument from 'int' to 'bool' [loplugin:implicitboolconversion]
      209 |     assert(primary > 0);
          |            ^~~~~~~~~~~
    /usr/include/assert.h:157:42: note: expanded from macro 'assert'
      157 |     ((void) sizeof (__assert_single_arg (__VA_ARGS__)), __extension__ ({ \
          |                                          ^~~~~~~~~~~
    /home/michi/development/git/libreoffice/solenv/bin/concat-deps.c:210:12: error: implicit conversion (IntegralToBoolean) of call argument from 'int' to 'bool' [loplugin:implicitboolconversion]
      210 |     assert(secondary >= 0);
          |            ^~~~~~~~~~~~~~
    /usr/include/assert.h:157:42: note: expanded from macro 'assert'
      157 |     ((void) sizeof (__assert_single_arg (__VA_ARGS__)), __extension__ ({ \
          |                                          ^~~~~~~~~~~
    /home/michi/development/git/libreoffice/solenv/bin/concat-deps.c:211:12: error: implicit conversion (IntegralToBoolean) of call argument from 'int' to 'bool' [loplugin:implicitboolconversion]
      211 |     assert(size_elem > 0);
          |            ^~~~~~~~~~~~~
    /usr/include/assert.h:157:42: note: expanded from macro 'assert'
      157 |     ((void) sizeof (__assert_single_arg (__VA_ARGS__)), __extension__ ({ \
          |                                          ^~~~~~~~~~~
    /home/michi/development/git/libreoffice/solenv/bin/concat-deps.c:437:12: error: implicit conversion (IntegralToBoolean) of call argument from 'int' to 'bool' [loplugin:implicitboolconversion]
      437 |     assert(size > 0);
          |            ^~~~~~~~
    /usr/include/assert.h:157:42: note: expanded from macro 'assert'
      157 |     ((void) sizeof (__assert_single_arg (__VA_ARGS__)), __extension__ ({ \
          |                                          ^~~~~~~~~~~
    /home/michi/development/git/libreoffice/solenv/bin/concat-deps.c:615:12: error: implicit conversion (IntegralToBoolean) of call argument from 'int' to 'bool' [loplugin:implicitboolconversion]
      615 |     assert(name != NULL);
          |     ~~~~~~~^~~~~~~~~~~~~
    /usr/include/assert.h:157:42: note: expanded from macro 'assert'
      157 |     ((void) sizeof (__assert_single_arg (__VA_ARGS__)), __extension__ ({ \
          |                                          ^~~~~~~~~~~
    /home/michi/development/git/libreoffice/solenv/bin/concat-deps.c:851:12: error: implicit conversion (IntegralToBoolean) of call argument from 'int' to 'bool' [loplugin:implicitboolconversion]
      851 |     assert('\0' == *end);
          |            ^~~~~~~~~~~~
    /usr/include/assert.h:157:42: note: expanded from macro 'assert'
      157 |     ((void) sizeof (__assert_single_arg (__VA_ARGS__)), __extension__ ({ \
          |                                          ^~~~~~~~~~~
    /home/michi/development/git/libreoffice/solenv/bin/concat-deps.c:1113:12: error: implicit conversion (PointerToBoolean) of call argument from 'char *' to 'bool' [loplugin:implicitboolconversion]
     1113 |     assert(phony_content_buffer); // Don't handle OOM conditions
          |            ^~~~~~~~~~~~~~~~~~~~
    10 errors generated.
    make[1]: *** No rule to make target '/home/michi/development/git/libreoffice/workdir/CObject/solenv/bin/concat-deps.o', needed by '/home/michi/development/git/libreoffice/workdir/LinkTarget/Executable/concat-deps'.  Stop.
    make: *** [Makefile:137: solenv] Error 2

Change-Id: I6621e146999551b98cbc006509a72c86745fcd65
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209870
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-08-26 11:38:46 +02:00

17 lines
519 B
Makefile

# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_Executable_Executable,concat-deps))
$(eval $(call gb_Executable_add_exception_objects,concat-deps,\
solenv/bin/concat-deps, $(gb_COMPILEROPTFLAGS) \
))
# vim: set noet sw=4 ts=4: