Opened 5 years ago

Closed 4 years ago

#59931 closed defect (fixed)

pstoedit @3.75 does not build on PPC Tiger, Mac OS X 10.4.11, because 'body of constexpr function 'constexpr float rnd(float, float)' not a return-statement'

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: kencu (Ken)
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: tiger Cc:
Port: pstoedit

Description

libtool: compile:  /opt/local/bin/g++-mp-7 -DHAVE_CONFIG_H -I. -DHAVE_LIBPLOTTER -DHAVE_MKSTEMP -DHAVE_MAGIC -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/opt/local/include/ImageMagick-6 -DHAVE_LIBZIP -DDEFAULTGS=gs -DPSTOEDITDATADIR=\"/opt/local/share/pstoedit\" -DPSTOEDITLIBDIR=\"/opt/local/lib/pstoedit\" -Wall -Wextra -Wuninitialized -Wswitch-default -Wunused -Wshadow -Wwrite-strings -Wcast-qual -Wpointer-arith -Wno-long-long -I/opt/local/include -Wno-long-long -D_BIG_ENDIAN -pipe -Os -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -arch ppc -DINTERNALBOOL -MT drvpdf.lo -MD -MP -MF .deps/drvpdf.Tpo -c drvpdf.cpp  -fno-common -DPIC -o .libs/drvpdf.o
drvpdf.cpp: In function 'constexpr float rnd(float, float)':
drvpdf.cpp:49:1: error: body of constexpr function 'constexpr float rnd(float, float)' not a return-statement
 }
 ^
make[2]: *** [drvpdf.lo] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_graphics_pstoedit/pstoedit/work/pstoedit-3.75/src'

The source code is:

   44	static constexpr float rnd(const float f, const float roundnumber)
   45	{
   46		const float roundup = (f < 0.0f) ? -0.5f : 0.5f;
   47		return ((long int) ((f * roundnumber) + roundup)) / roundnumber;
   48	
   49	}
   50	
   51	static inline float RND3(const float f)
   52	{
   53		return rnd(f, 1000.0f);
   54	}

Should the return statement better be:

   47		return (((long int) ((f * roundnumber) + roundup)) / roundnumber);

Attachments (1)

main.log (67.7 KB) - added by ballapete (Peter "Pete" Dyballa) 5 years ago.
Main.log from PPC Tiger

Download all attachments as: .zip

Change History (4)

Changed 5 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

Main.log from PPC Tiger

comment:1 Changed 5 years ago by ballapete (Peter "Pete" Dyballa)

The same happens on PPC Leopard, Mac OS X 10.5.8:

libtool: compile:  /opt/local/bin/g++-mp-7 -DHAVE_CONFIG_H -I. -DHAVE_LIBPLOTTER -DHAVE_MKSTEMP -DHAVE_MAGIC -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/opt/local/include/ImageMagick-6 -DHAVE_LIBZIP -DDEFAULTGS=gs -DPSTOEDITDATADIR=\"/opt/local/share/pstoedit\" -DPSTOEDITLIBDIR=\"/opt/local/lib/pstoedit\" -Wall -Wextra -Wuninitialized -Wswitch-default -Wunused -Wshadow -Wwrite-strings -Wcast-qual -Wpointer-arith -Wno-long-long -I/opt/local/include -Wno-long-long -D_BIG_ENDIAN -pipe -Os -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -arch ppc -DINTERNALBOOL -MT drvpdf.lo -MD -MP -MF .deps/drvpdf.Tpo -c drvpdf.cpp  -fno-common -DPIC -o .libs/drvpdf.o
drvpdf.cpp: In function 'constexpr float rnd(float, float)':
drvpdf.cpp:49:1: error: body of constexpr function 'constexpr float rnd(float, float)' not a return-statement
 }
 ^
make[2]: *** [drvpdf.lo] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_graphics_pstoedit/pstoedit/work/pstoedit-3.75/src'

comment:2 Changed 5 years ago by ballapete (Peter "Pete" Dyballa)

On High Sierra (and also in documention) I am getting this hint:

libtool: compile:  /usr/bin/clang++ -DHAVE_CONFIG_H -I. -DHAVE_LIBPLOTTER -DHAVE_MKSTEMP -DHAVE_MAGIC -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/opt/local/include/ImageMagick-6 -DHAVE_LIBZIP -DDEFAULTGS=gs -DPSTOEDITDATADIR=\"/opt/local/share/pstoedit\" -DPSTOEDITLIBDIR=\"/opt/local/lib/pstoedit\" -Wall -Wextra -Wuninitialized -Wswitch-default -Wunused -Wshadow -Wwrite-strings -Wcast-qual -Wpointer-arith -Wno-long-long -I/opt/local/include -Wno-long-long -D_LITTLE_ENDIAN -pipe -Os -std=c++11 -stdlib=libc++ -arch x86_64 -DINTERNALBOOL -MT drvpdf.lo -MD -MP -MF .deps/drvpdf.Tpo -c drvpdf.cpp  -fno-common -DPIC -o .libs/drvpdf.o
drvpdf.cpp:46:14: warning: variable declaration in a constexpr function is a C++14 extension [-Wc++14-extensions]
        const float roundup = (f < 0.0f) ? -0.5f : 0.5f;
                    ^
1 warning generated.

And indeed on Leopard using C++ Standard from 2014 allows pstoedit to build.

comment:3 Changed 4 years ago by kencu (Ken)

Owner: set to kencu
Resolution: fixed
Status: newclosed

In 4643df2c3591ab29da5010495cf806efd5796425/macports-ports (master):

pstoedit: requires c++14

thanks to @ballapete for the fix

although clangs up to at least clang-9.0 will let this
through with a warning, gcc will not, and clangs are
getting steadily stricter as well

closes: #59931

Note: See TracTickets for help on using tickets.