Bug 366786 - Libraw fails to build with CLang (C++11 non constant initializer narrowing)
Summary: Libraw fails to build with CLang (C++11 non constant initializer narrowing)
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-DImg-RAW (show other bugs)
Version: 5.1.0
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-15 10:27 UTC by Matthias Fauconneau
Modified: 2016-08-16 07:01 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.2.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Fauconneau 2016-08-15 10:27:38 UTC
[ 88%] Building CXX object libs/rawengine/libraw/CMakeFiles/libraw.dir/src/libraw_cxx.cpp.o
In file included from /var/tmp/portage/media-gfx/digikam-5.1.0/work/digikam-5.1.0/core/libs/rawengine/libraw/src/libraw_cxx.cpp:5203:
/var/tmp/portage/media-gfx/digikam-5.1.0/work/digikam-5.1.0/core/libs/rawengine/libraw/src/../internal/libraw_x3f.cpp:1249:19: error: 
      non-constant-expression cannot be narrowed from type 'int' to 'int16_t'
      (aka 'short') in initializer list [-Wc++11-narrowing]
  int16_t c[3] = {offset,offset,offset};
                  ^~~~~~
/var/tmp/portage/media-gfx/digikam-5.1.0/work/digikam-5.1.0/core/libs/rawengine/libraw/src/../internal/libraw_x3f.cpp:1249:19: note: 
      insert an explicit cast to silence this issue
  int16_t c[3] = {offset,offset,offset};
                  ^~~~~~
                  static_cast<int16_t>( )
/var/tmp/portage/media-gfx/digikam-5.1.0/work/digikam-5.1.0/core/libs/rawengine/libraw/src/../internal/libraw_x3f.cpp:1249:26: error: 
      non-constant-expression cannot be narrowed from type 'int' to 'int16_t'
      (aka 'short') in initializer list [-Wc++11-narrowing]
  int16_t c[3] = {offset,offset,offset};
                         ^~~~~~
/var/tmp/portage/media-gfx/digikam-5.1.0/work/digikam-5.1.0/core/libs/rawengine/libraw/src/../internal/libraw_x3f.cpp:1249:26: note: 
      insert an explicit cast to silence this issue
  int16_t c[3] = {offset,offset,offset};
                         ^~~~~~
                         static_cast<int16_t>( )
/var/tmp/portage/media-gfx/digikam-5.1.0/work/digikam-5.1.0/core/libs/rawengine/libraw/src/../internal/libraw_x3f.cpp:1249:33: error: 
      non-constant-expression cannot be narrowed from type 'int' to 'int16_t'
      (aka 'short') in initializer list [-Wc++11-narrowing]
  int16_t c[3] = {offset,offset,offset};
                                ^~~~~~
/var/tmp/portage/media-gfx/digikam-5.1.0/work/digikam-5.1.0/core/libs/rawengine/libraw/src/../internal/libraw_x3f.cpp:1249:33: note: 
      insert an explicit cast to silence this issue
  int16_t c[3] = {offset,offset,offset};
                                ^~~~~~
                                static_cast<int16_t>( )

P.S: Is there an option to either disable or use system libraw ?

Reproducible: Always
Comment 1 caulier.gilles 2016-08-15 11:00:46 UTC
>P.S: Is there an option to either disable or use system libraw ?

No because we compile internal libraw with internal Adobe DNG SDK

Gilles Caulier
Comment 2 caulier.gilles 2016-08-16 06:53:52 UTC
Do you use "-std=c++11" GCC compiler option ?

What's are the compilation details with you use "export VERBOSE=1"

Gilles Caulier
Comment 3 caulier.gilles 2016-08-16 06:59:42 UTC
In fact the rules to prevent broken compilation already with Clang under OSX. I will adjust rules for everywhere.

Gilles Caulier
Comment 4 caulier.gilles 2016-08-16 07:01:07 UTC
Git commit f8530c8e7c0de68bf6e0f02bf84c8d0b96d3c589 by Gilles Caulier.
Committed on 16/08/2016 at 07:00.
Pushed by cgilles into branch 'master'.

adjust Libraw C++11 rules for linux and Windows too
FIXED-IN: 5.2.0

M  +2    -2    libs/rawengine/libraw/CMakeLists.txt

http://commits.kde.org/digikam/f8530c8e7c0de68bf6e0f02bf84c8d0b96d3c589