Haskell-Things / ImplicitCAD

A math-inspired CAD program in haskell. CSG, bevels, and shells; 2D & 3D geometry; 2D gcode generation...
https://implicitcad.org/
GNU Affero General Public License v3.0
1.33k stars 141 forks source link

`-fspecialise-aggressively`, CI `-Werror` #409

Closed sorki closed 2 years ago

sorki commented 2 years ago

This seems to specialise imported functions so we no longer get warnings like

./Graphics/Implicit/IntegralUtil.hs: warning: [-Wall-missed-specialisations]
    Could not specialise imported function ‘GHC.Real.$wfromIntegral’
      when specialising ‘fromIntegral’
    Probable fix: add INLINABLE pragma on ‘GHC.Real.$wfromIntegral’

and we can enable -Werror for CI builds since there are no other warnings \o/

From the dosc of the flag:

By default only type class methods and methods marked INLINABLE or INLINE are specialised. This flag will specialise any overloaded function regardless of size if its unfolding is available. This flag is not included in any optimisation level as it can massively increase code size. It can be used in conjunction with -fexpose-all-unfoldings if you want to ensure all calls are specialised.

The impact on on binary size (extopenscad) seems to be less than 0.1MB. Not sure about performance impact.

sorki commented 2 years ago

Switching to CI only for both flags after IRC discussion. Explanation in https://github.com/Haskell-Things/ImplicitCAD/pull/409/commits/024ca2af27e2682337a6cca5a0894b71b742fc62

Alternative would be disabling -Wall-missed-specialisations and possibly also -Wmissed-specialisations but this does the job.