Comments (10)
Is it ok, if I just remove flag [-Werror]?
from libavif.
This is due to incompatible-pointer-types-discards-qualifiers.
What is weird is that I cannot reproduce it locally with calang, even with -Wincompatible-pointer-types-discards-qualifiers
.
from libavif.
Alexander: What is the output of /usr/bin/cc --version
?
You can pass -DAVIF_ENABLE_WERROR=OFF
to the cmake command to not treat compiler warnings as errors. The default of the AVIF_ENABLE_WERROR
option is ON
.
Vincent: The compiler may be right, but this is beyond my knowledge of the C language. I only know that in function prototypes, const double A[3][3]
is the same as const double A[][3]
. So that matches the const double (*)[3]
in the warning message.
Rather than trying to understand this esoteric part of the C language, we can put the two-dimensional array in a struct and pass a pointer to the struct as the function parameter.
from libavif.
A struct would end up having the same problem as it would contain a [3][3]. The simplest I could think of to minimize changes is #1932
from libavif.
Hit the same error using gcc-4.4.7 and gcc-4.9.4 in the main branch.
Here is the error output from gcc-4.9.4:
/tmp/libavif/src/colrconvert.c: In function 'avifColorPrimariesComputeRGBToXYZD50Matrix':
/tmp/libavif/src/colrconvert.c:112:16: error: passing argument 1 of 'avifVecMul' from incompatible pointer type [-Werror]
avifVecMul(rgbPrimariesInv, whitePointXYZ, rgbCoefficients);
^
/tmp/libavif/src/colrconvert.c:76:13: note: expected 'const double (*)[3]' but argument is of type 'double (*)[3]'
static void avifVecMul(const double M[3][3], const double x[3], double y[3])
^
/tmp/libavif/src/colrconvert.c:118:30: error: passing argument 2 of 'avifMatMul' from incompatible pointer type [-Werror]
avifMatMul(rgbPrimaries, rgbCoefficientsMat, rgbXYZ);
^
/tmp/libavif/src/colrconvert.c:48:13: note: expected 'const double (*)[3]' but argument is of type 'double (*)[3]'
static void avifMatMul(const double A[3][3], const double B[3][3], double C[3][3])
^
/tmp/libavif/src/colrconvert.c:136:16: error: passing argument 1 of 'avifMatMul' from incompatible pointer type [-Werror]
avifMatMul(adaptation, avifBradford, tmp);
^
/tmp/libavif/src/colrconvert.c:48:13: note: expected 'const double (*)[3]' but argument is of type 'double (*)[3]'
static void avifMatMul(const double A[3][3], const double B[3][3], double C[3][3])
^
/tmp/libavif/src/colrconvert.c:142:16: error: passing argument 1 of 'avifMatMul' from incompatible pointer type [-Werror]
avifMatMul(bradfordInv, tmp, adaptation);
^
/tmp/libavif/src/colrconvert.c:48:13: note: expected 'const double (*)[3]' but argument is of type 'double (*)[3]'
static void avifMatMul(const double A[3][3], const double B[3][3], double C[3][3])
^
/tmp/libavif/src/colrconvert.c:142:29: error: passing argument 2 of 'avifMatMul' from incompatible pointer type [-Werror]
avifMatMul(bradfordInv, tmp, adaptation);
^
/tmp/libavif/src/colrconvert.c:48:13: note: expected 'const double (*)[3]' but argument is of type 'double (*)[3]'
static void avifMatMul(const double A[3][3], const double B[3][3], double C[3][3])
^
/tmp/libavif/src/colrconvert.c:144:16: error: passing argument 1 of 'avifMatMul' from incompatible pointer type [-Werror]
avifMatMul(adaptation, rgbXYZ, coeffs);
^
/tmp/libavif/src/colrconvert.c:48:13: note: expected 'const double (*)[3]' but argument is of type 'double (*)[3]'
static void avifMatMul(const double A[3][3], const double B[3][3], double C[3][3])
^
/tmp/libavif/src/colrconvert.c:144:28: error: passing argument 2 of 'avifMatMul' from incompatible pointer type [-Werror]
avifMatMul(adaptation, rgbXYZ, coeffs);
^
/tmp/libavif/src/colrconvert.c:48:13: note: expected 'const double (*)[3]' but argument is of type 'double (*)[3]'
static void avifMatMul(const double A[3][3], const double B[3][3], double C[3][3])
^
In file included from /tmp/libavif/src/colrconvert.c:4:0:
/tmp/libavif/src/colrconvert.c: In function 'avifColorPrimariesComputeXYZD50ToRGBMatrix':
/tmp/libavif/src/colrconvert.c:153:27: error: passing argument 1 of 'avifMatInv' from incompatible pointer type [-Werror]
AVIF_CHECK(avifMatInv(rgbToXyz, coeffs));
^
/tmp/libavif/include/avif/internal.h:37:15: note: in definition of macro 'AVIF_CHECK'
if (!(A)) { \
^
/tmp/libavif/src/colrconvert.c:25:17: note: expected 'const double (*)[3]' but argument is of type 'double (*)[3]'
static avifBool avifMatInv(const double M[3][3], double I[3][3])
^
/tmp/libavif/src/colrconvert.c: In function 'avifColorPrimariesComputeRGBToRGBMatrix':
/tmp/libavif/src/colrconvert.c:169:16: error: passing argument 1 of 'avifMatMul' from incompatible pointer type [-Werror]
avifMatMul(xyzToDstRGB, srcRGBToXYZ, coeffs);
^
/tmp/libavif/src/colrconvert.c:48:13: note: expected 'const double (*)[3]' but argument is of type 'double (*)[3]'
static void avifMatMul(const double A[3][3], const double B[3][3], double C[3][3])
^
/tmp/libavif/src/colrconvert.c:169:29: error: passing argument 2 of 'avifMatMul' from incompatible pointer type [-Werror]
avifMatMul(xyzToDstRGB, srcRGBToXYZ, coeffs);
^
/tmp/libavif/src/colrconvert.c:48:13: note: expected 'const double (*)[3]' but argument is of type 'double (*)[3]'
static void avifMatMul(const double A[3][3], const double B[3][3], double C[3][3])
^
cc1: all warnings being treated as errors
from libavif.
@sezero , does #1946 fully fixes it for you? Thx
from libavif.
Unfortunately no.
With gcc-4.4.7:
cc1: warnings being treated as errors
/tmp/libavif/src/colrconvert.c: In function ‘avifColorPrimariesComputeRGBToXYZD50Matrix’:
/tmp/libavif/src/colrconvert.c:109: error: passing argument 1 of ‘avifMatInv’ from incompatible pointer type
/tmp/libavif/src/colrconvert.c:25: note: expected ‘double (*)[3]’ but argument is of type ‘const double (*)[3]’
/tmp/libavif/src/colrconvert.c:118: error: passing argument 1 of ‘avifMatMul’ from incompatible pointer type
/tmp/libavif/src/colrconvert.c:48: note: expected ‘double (*)[3]’ but argument is of type ‘const double (*)[3]’
/tmp/libavif/src/colrconvert.c:124: error: passing argument 1 of ‘avifVecMul’ from incompatible pointer type
/tmp/libavif/src/colrconvert.c:76: note: expected ‘double (*)[3]’ but argument is of type ‘const double (*)[3]’
/tmp/libavif/src/colrconvert.c:136: error: passing argument 2 of ‘avifMatMul’ from incompatible pointer type
/tmp/libavif/src/colrconvert.c:48: note: expected ‘double (*)[3]’ but argument is of type ‘const double (*)[3]’
/tmp/libavif/src/colrconvert.c:139: error: passing argument 1 of ‘avifMatInv’ from incompatible pointer type
/tmp/libavif/src/colrconvert.c:25: note: expected ‘double (*)[3]’ but argument is of type ‘const double (*)[3]’
/tmp/libavif/src/colrconvert.c: In function ‘avifLinearRGBConvertColorSpace’:
/tmp/libavif/src/colrconvert.c:182: error: passing argument 1 of ‘avifVecMul’ from incompatible pointer type
/tmp/libavif/src/colrconvert.c:76: note: expected ‘double (*)[3]’ but argument is of type ‘const double (*)[3]’
With gcc-4.9.4:
In file included from /tmp/libavif/src/colrconvert.c:4:0:
/tmp/libavif/src/colrconvert.c: In function 'avifColorPrimariesComputeRGBToXYZD50Matrix':
/tmp/libavif/src/colrconvert.c:109:27: error: passing argument 1 of 'avifMatInv' from incompatible pointer type [-Werror]
AVIF_CHECK(avifMatInv(rgbPrimaries, rgbPrimariesInv));
^
/tmp/libavif/include/avif/internal.h:37:15: note: in definition of macro 'AVIF_CHECK'
if (!(A)) { \
^
/tmp/libavif/src/colrconvert.c:25:17: note: expected 'double (*)[3]' but argument is of type 'const double (*)[3]'
static avifBool avifMatInv(double M[3][3], double I[3][3])
^
/tmp/libavif/src/colrconvert.c:118:16: error: passing argument 1 of 'avifMatMul' from incompatible pointer type [-Werror]
avifMatMul(rgbPrimaries, rgbCoefficientsMat, rgbXYZ);
^
/tmp/libavif/src/colrconvert.c:48:13: note: expected 'double (*)[3]' but argument is of type 'const double (*)[3]'
static void avifMatMul(double A[3][3], double B[3][3], double C[3][3])
^
/tmp/libavif/src/colrconvert.c:124:16: error: passing argument 1 of 'avifVecMul' from incompatible pointer type [-Werror]
avifVecMul(avifBradford, whitePointXYZ, lms);
^
/tmp/libavif/src/colrconvert.c:76:13: note: expected 'double (*)[3]' but argument is of type 'const double (*)[3]'
static void avifVecMul(double M[3][3], const double x[3], double y[3])
^
/tmp/libavif/src/colrconvert.c:136:28: error: passing argument 2 of 'avifMatMul' from incompatible pointer type [-Werror]
avifMatMul(adaptation, avifBradford, tmp);
^
/tmp/libavif/src/colrconvert.c:48:13: note: expected 'double (*)[3]' but argument is of type 'const double (*)[3]'
static void avifMatMul(double A[3][3], double B[3][3], double C[3][3])
^
/tmp/libavif/src/colrconvert.c:139:21: error: passing argument 1 of 'avifMatInv' from incompatible pointer type [-Werror]
if (!avifMatInv(avifBradford, bradfordInv)) {
^
/tmp/libavif/src/colrconvert.c:25:17: note: expected 'double (*)[3]' but argument is of type 'const double (*)[3]'
static avifBool avifMatInv(double M[3][3], double I[3][3])
^
/tmp/libavif/src/colrconvert.c: In function 'avifLinearRGBConvertColorSpace':
/tmp/libavif/src/colrconvert.c:182:16: error: passing argument 1 of 'avifVecMul' from incompatible pointer type [-Werror]
avifVecMul(coeffs, rgbDouble, converted);
^
/tmp/libavif/src/colrconvert.c:76:13: note: expected 'double (*)[3]' but argument is of type 'const double (*)[3]'
static void avifVecMul(double M[3][3], const double x[3], double y[3])
^
cc1: all warnings being treated as errors
from libavif.
@sezero , I updated the PR. Can you please try again? And comment there for any new defects. Thx
from libavif.
@sezero , I updated the PR. Can you please try again? And comment there for any new defects. Thx
Yes: building with gcc 4.4.7 and 4.9.4 works with #1946 applied. Thanks.
from libavif.
I guess this can be closed since #1946 is in?
from libavif.
Related Issues (20)
- Sample HDR AVIF decoded to JPG shows incorrect colors HOT 8
- How to build a dynamic library that statically links all dependencies? HOT 1
- Ignore and skip FullBoxes with an unrecognized version
- How to build the.A use of iOS platform? HOT 2
- Make libyuv package-friendly dependency HOT 2
- Roll YCgCo-R out HOT 1
- Add Homebrew install instructions and avifdec/avifenc examples to README HOT 6
- autoconf etc. HOT 1
- avifImageRGBToYUV should set color space to default values HOT 2
- Findrav1e.cmake ignores library dependencies listed in the generated pkgconfig file HOT 5
- [Function Request] avifenc supports svt and rav1e encoder options key-value HOT 2
- MSYS/MinGW32: Linking error, undefined references to Nt file functions HOT 2
- Noticeable color shift HOT 6
- Does CVE-2024-1580 affect libavif with dav1d decoder? HOT 1
- Static build issues on MSYS2 HOT 4
- sharpyuv conversion failed HOT 2
- libavif.a should not be a combined archive library HOT 6
- Not able to build static build on amazon linux 2023 HOT 9
- GIF encodes with wrong frame rate HOT 14
- Avif-alpha is working as expected HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libavif.