Giter VIP home page Giter VIP logo

Comments (10)

marchLex avatar marchLex commented on September 22, 2024

Is it ok, if I just remove flag [-Werror]?

from libavif.

vrabaud avatar vrabaud commented on September 22, 2024

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.

wantehchang avatar wantehchang commented on September 22, 2024

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.

vrabaud avatar vrabaud commented on September 22, 2024

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.

sezero avatar sezero commented on September 22, 2024

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.

vrabaud avatar vrabaud commented on September 22, 2024

@sezero , does #1946 fully fixes it for you? Thx

from libavif.

sezero avatar sezero commented on September 22, 2024

@sezero , does #1946 fully fixes it for you? Thx

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.

vrabaud avatar vrabaud commented on September 22, 2024

@sezero , I updated the PR. Can you please try again? And comment there for any new defects. Thx

from libavif.

sezero avatar sezero commented on September 22, 2024

@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.

sezero avatar sezero commented on September 22, 2024

I guess this can be closed since #1946 is in?

from libavif.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.