ebassi / graphene

A thin layer of graphic data types
http://ebassi.github.io/graphene
Other
373 stars 80 forks source link

error when enabling -Werror=double-promotion on software using this library #249

Open alex-tee opened 2 years ago

alex-tee commented 2 years ago

Experienced behavior

次のファイルから読み込み:  /usr/include/graphene-1.0/graphene.h:38,
         次から読み込み:  /usr/include/gtk-4.0/gsk/gsktypes.h:25,
         次から読み込み:  /usr/include/gtk-4.0/gsk/gskrenderer.h:26,
         次から読み込み:  /usr/include/gtk-4.0/gsk/gsk.h:24,
         次から読み込み:  /usr/include/gtk-4.0/gtk/gtk.h:32,
         次から読み込み:  ../inc/utils/yaml.h:29,
         次から読み込み:  ../inc/audio/curve.h:33,
         次から読み込み:  ../inc/audio/automation_point.h:29,
         次から読み込み:  ../inc/audio/region.h:28,
         次から読み込み:  ../src/gui/widgets/event_viewer.c:4:
/usr/include/graphene-1.0/graphene-simd4x4f.h: 関数 ‘graphene_simd4x4f_init_look_at’ 内:
/usr/include/graphene-1.0/graphene-simd4x4f.h:659:51: エラー: implicit conversion from ‘float’ to ‘double’ to match other operand of binary expression [-Werror=double-promotion]
  659 |       if (fabs (graphene_simd4f_get_z (up) - 1.0) < FLT_EPSILON)

Expected behavior

No error

Steps to reproduce

  1. add -Werror=double-promotion to CFLAGS and include <gtk/gtk.h>

Operating system in use

arch linux (parabola)

SIMD implementation in use

not sure but this might say: /usr/include/graphene-1.0/graphene-simd4x4f.h

Graphene version

1.10.8

alex-tee commented 2 years ago

also getting more issues with -Werror=conversion

/usr/include/graphene-1.0/graphene-rect.h:51:40: エラー: conversion from ‘int’ to ‘float’ may change value [-Werror=conversion]
   51 |   (graphene_rect_t) { .origin = { .x = (_x), .y = (_y) }, .size = { .width = (_w), .height = (_h) } }

although this is probably the fault of my own source code when using the macros

EDIT: pls ignore this, this was my own fault

alex-tee commented 2 years ago

https://github.com/alex-tee/graphene-test

here is a simple meson project to reproduce it, just run meson build and meson compile -C build and you should get this error

ebassi commented 7 months ago

The short answer is: do not enable compiler errors with external libraries that have made no guarantee whatsoever about those same errors.

The longer answer is: patches welcome.

tristan957 commented 5 months ago

Hey ebassi,

What would a PR look like here that you would deem acceptable?

I'm also more than happy to work around this downstream if you're not ready to accept a patch at this time.

ebassi commented 1 month ago

I would accept a pull request that fixed the header files, assuming it's not going to make them completely unreadable.