Skip to content

rounddown() and roundup() macro clash on FreeBSD

Building 1.3 on FreeBSD (using CMake) fails:

samu: job failed with status 1: /ccache/libexec/ccache/c++ -DHAVE_CONFIG_H -DHAVE_X11 -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -DWITH_CSSBLEND -DWITH_MESH -DWITH_SVG2 -D_THREAD_SAFE -I/wrkdirs/overlays/overlay/graphics/inkscape/work/.build/src/livarot -I/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/livarot -I/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4 -I/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src -I/wrkdirs/overlays/overlay/graphics/inkscape/work/.build/include -I/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/3rdparty/2geom/include -I/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/3rdparty/2geom/include/2geom -isystem /usr/local/include/harfbuzz -isystem /usr/local/include/freetype2 -isystem /usr/local/include/libpng16 -isystem /usr/local/include -isystem /usr/local/include/glib-2.0 -isystem /usr/local/lib/glib-2.0/include -isystem /usr/local/include/pango-1.0 -isystem /usr/local/include/fribidi -isystem /usr/local/include/cairo -isystem /usr/local/include/pixman-1 -isystem /usr/local/include/libsoup-2.4 -isystem /usr/local/include/libxml2 -isystem /usr/local/include/poppler -isystem /usr/local/include/libwpg-0.3 -isystem /usr/local/include/librevenge-0.0 -isystem /usr/local/include/libwpd-0.10 -isystem /usr/local/include/libvisio-0.1 -isystem /usr/local/include/libcdr-0.1 -isystem /usr/local/include/gtkmm-3.0 -isystem /usr/local/lib/gtkmm-3.0/include -isystem /usr/local/include/atkmm-1.6 -isystem /usr/local/lib/atkmm-1.6/include -isystem /usr/local/include/glibmm-2.4 -isystem /usr/local/lib/glibmm-2.4/include -isystem /usr/local/include/sigc++-2.0 -isystem /usr/local/lib/sigc++-2.0/include -isystem /usr/local/include/atk-1.0 -isystem /usr/local/include/giomm-2.4 -isystem /usr/local/lib/giomm-2.4/include -isystem /usr/local/include/pangomm-1.4 -isystem /usr/local/lib/pangomm-1.4/include -isystem /usr/local/include/cairomm-1.0 -isystem /usr/local/lib/cairomm-1.0/include -isystem /usr/local/include/gtk-3.0 -isystem /usr/local/include/gdk-pixbuf-2.0 -isystem /usr/local/include/gio-unix-2.0 -isystem /usr/local/include/libepoll-shim -isystem /usr/local/include/at-spi2-atk/2.0 -isystem /usr/local/include/at-spi-2.0 -isystem /usr/local/include/dbus-1.0 -isystem /usr/local/lib/dbus-1.0/include -isystem /usr/local/include/gtk-3.0/unix-print -isystem /usr/local/include/gdkmm-3.0 -isystem /usr/local/lib/gdkmm-3.0/include -isystem /usr/local/include/gspell-1 -isystem /usr/local/include/enchant-2 -isystem /usr/local/include/gtksourceview-4 -isystem /usr/local/include/ImageMagick-6 -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -DG_DISABLE_ASSERT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DGLIBMM_DISABLE_DEPRECATED -DGTKMM_DISABLE_DEPRECATED -DGDKMM_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -fstack-protector-strong -Werror=format -Werror=format-security -Werror=ignored-qualifiers -Werror=return-type -Wno-switch -Wmisleading-indentation -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -D_THREAD_SAFE -pthread -D_THREAD_SAFE -D_THREAD_SAFE -D_GNU_SOURCE -fopenmp=libomp -DSIGCXX_DISABLE_DEPRECATED -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -DNDEBUG -std=gnu++17   -pthread -fPIC -fdiagnostics-color -MD -MT src/livarot/CMakeFiles/livarot_LIB.dir/PathCutting.cpp.o -MF src/livarot/CMakeFiles/livarot_LIB.dir/PathCutting.cpp.o.d -o src/livarot/CMakeFiles/livarot_LIB.dir/PathCutting.cpp.o -c /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/livarot/PathCutting.cpp
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/livarot/PathCutting.cpp:32:
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/geom.h:22:
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:82:25: error: expected ')'
T constexpr rounddown(T a, T b)
                        ^
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:82:13: note: to match this '('
T constexpr rounddown(T a, T b)
            ^
/usr/include/sys/param.h:325:27: note: expanded from macro 'rounddown'
#define rounddown(x, y) (((x)/(y))*(y))
                          ^
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/livarot/PathCutting.cpp:32:
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/geom.h:22:
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:82:13: error: expected ')'
T constexpr rounddown(T a, T b)
            ^
/usr/include/sys/param.h:325:30: note: expanded from macro 'rounddown'
#define rounddown(x, y) (((x)/(y))*(y))
                             ^
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:82:13: note: to match this '('
/usr/include/sys/param.h:325:26: note: expanded from macro 'rounddown'
#define rounddown(x, y) (((x)/(y))*(y))
                         ^
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/livarot/PathCutting.cpp:32:
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/geom.h:22:
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:82:13: error: expected ')'
T constexpr rounddown(T a, T b)
            ^
/usr/include/sys/param.h:325:35: note: expanded from macro 'rounddown'
#define rounddown(x, y) (((x)/(y))*(y))
                                  ^
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:82:13: note: to match this '('
/usr/include/sys/param.h:325:25: note: expanded from macro 'rounddown'
#define rounddown(x, y) (((x)/(y))*(y))
                        ^
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/livarot/PathCutting.cpp:32:
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/geom.h:22:
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:84:5: error: expected expression
    return a - safemod(a, b);
    ^
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:85:2: error: expected ';' at end of declaration
}
 ^
 ;
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:89:23: error: expected ')'
T constexpr roundup(T a, T b)
                      ^
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:89:13: note: to match this '('
T constexpr roundup(T a, T b)
            ^
/usr/include/sys/param.h:327:26: note: expanded from macro 'roundup'
#define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))  /* to any y */
                           ^
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/livarot/PathCutting.cpp:32:
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/geom.h:22:
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:89:13: error: expected ')'
T constexpr roundup(T a, T b)
            ^
/usr/include/sys/param.h:327:29: note: expanded from macro 'roundup'
#define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))  /* to any y */
                              ^
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:89:13: note: to match this '('
/usr/include/sys/param.h:327:25: note: expanded from macro 'roundup'
#define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))  /* to any y */
                          ^
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/livarot/PathCutting.cpp:32:
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/geom.h:22:
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:89:13: error: expected ')'
T constexpr roundup(T a, T b)
            ^
/usr/include/sys/param.h:327:38: note: expanded from macro 'roundup'
#define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))  /* to any y */
                                       ^
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:89:13: note: to match this '('
/usr/include/sys/param.h:327:24: note: expanded from macro 'roundup'
#define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))  /* to any y */
                         ^
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/livarot/PathCutting.cpp:32:
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/geom.h:22:
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:89:13: error: expected ')'
T constexpr roundup(T a, T b)
            ^
/usr/include/sys/param.h:327:43: note: expanded from macro 'roundup'
#define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))  /* to any y */
                                            ^
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:89:13: note: to match this '('
/usr/include/sys/param.h:327:23: note: expanded from macro 'roundup'
#define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))  /* to any y */
                        ^
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/livarot/PathCutting.cpp:32:
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/geom.h:22:
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:89:21: error: redefinition of 'T'
T constexpr roundup(T a, T b)
                    ^
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:82:23: note: previous definition is here
T constexpr rounddown(T a, T b)
                      ^
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:91:5: error: expected expression
    return rounddown(a - 1, b) + b;
    ^
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/mathfns.h:92:2: error: expected ';' at end of declaration
}
 ^
 ;
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/livarot/PathCutting.cpp:32:
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/geom.h:58:38: error: expected ')'
inline auto rounddown(Geom::IntPoint const &a, Geom::IntPoint const &b)
                                     ^
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/geom.h:58:13: note: to match this '('
inline auto rounddown(Geom::IntPoint const &a, Geom::IntPoint const &b)
            ^
/usr/include/sys/param.h:325:27: note: expanded from macro 'rounddown'
#define rounddown(x, y) (((x)/(y))*(y))
                          ^
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/livarot/PathCutting.cpp:32:
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/geom.h:58:13: error: expected ')'
inline auto rounddown(Geom::IntPoint const &a, Geom::IntPoint const &b)
            ^
/usr/include/sys/param.h:325:30: note: expanded from macro 'rounddown'
#define rounddown(x, y) (((x)/(y))*(y))
                             ^
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/geom.h:58:13: note: to match this '('
/usr/include/sys/param.h:325:26: note: expanded from macro 'rounddown'
#define rounddown(x, y) (((x)/(y))*(y))
                         ^
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/livarot/PathCutting.cpp:32:
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/geom.h:58:13: error: expected ')'
inline auto rounddown(Geom::IntPoint const &a, Geom::IntPoint const &b)
            ^
/usr/include/sys/param.h:325:35: note: expanded from macro 'rounddown'
#define rounddown(x, y) (((x)/(y))*(y))
                                  ^
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/geom.h:58:13: note: to match this '('
/usr/include/sys/param.h:325:25: note: expanded from macro 'rounddown'
#define rounddown(x, y) (((x)/(y))*(y))
                        ^
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/livarot/PathCutting.cpp:32:
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/geom.h:58:29: error: no member named 'IntPoint' in namespace 'Geom'
inline auto rounddown(Geom::IntPoint const &a, Geom::IntPoint const &b)
                      ~~~~~~^
/usr/include/sys/param.h:325:28: note: expanded from macro 'rounddown'
#define rounddown(x, y) (((x)/(y))*(y))
                           ^
In file included from /wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/livarot/PathCutting.cpp:32:
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/geom.h:60:5: error: expected expression
    using namespace Inkscape::Util;
    ^
/wrkdirs/overlays/overlay/graphics/inkscape/work/inkscape-1.3_2023-07-21_0e150ed6c4/src/helper/geom.h:62:2: error: expected ';' after top level declarator
}
 ^
 ;
18 errors generated.
samu: subcommand failed

Similar deal to inkscape#4427 (closed). rounddown() and roundup() are macros defined in our system headers, so they are always exposed. Most likely need to rename these two functions.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information