ebassi / graphene

A thin layer of graphic data types

Home Page:http://ebassi.github.io/graphene

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

alex-tee opened this issue · comments

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

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

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

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.

Hey ebassi,

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

  • Fixing only the warnings in the public headers
  • Fixing all the warnings

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