r600/sfn: allow building with clang 6 (Android 9)
authorMauro Rossi <issor.oruam@gmail.com>
Mon, 7 Nov 2022 00:57:02 +0000 (01:57 +0100)
committerEric Engestrom <eric@engestrom.ch>
Wed, 23 Nov 2022 19:12:00 +0000 (19:12 +0000)
static constexpr const 'value' is replaced by static function
in all type_char template specializations
to avoid the following building errors happening with clang 6

/home/utente/pie-x86_kernel/prebuilts/clang/host/linux-x86/clang-4691093/bin/ld.lld: error: undefined symbol: r600::type_char<r600::ExportInstr>::value
>>> referenced by sfn_scheduler.cpp
>>>               sfn_sfn_scheduler.cpp.o:(bool r600::BlockSheduler::collect_ready_type<r600::ExportInstr>(std::__1::list<r600::ExportInstr*, std::__1::allocator<r600::ExportInstr*> >&, std::__1::list<r600::ExportInstr*, std::__1::allocator<r600::ExportInstr*> >&)) in archive src/gallium/drivers/r600/libr600.a
...
/home/utente/pie-x86_kernel/prebuilts/clang/host/linux-x86/clang-4691093/bin/ld.lld: error: undefined symbol: r600::type_char<r600::RatInstr>::value
>>> referenced by sfn_scheduler.cpp
>>>               sfn_sfn_scheduler.cpp.o:(bool r600::BlockSheduler::collect_ready_type<r600::RatInstr>(std::__1::list<r600::RatInstr*, std::__1::allocator<r600::RatInstr*> >&, std::__1::list<r600::RatInstr*, std::__1::allocator<r600::RatInstr*> >&)) in archive src/gallium/drivers/r600/libr600.a
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)

Cc: "22.2" "22.3" mesa-stable
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19873>
(cherry picked from commit e74d989a6935ce11d06970a3c98b474b7773c905)

.pick_status.json
src/gallium/drivers/r600/sfn/sfn_scheduler.cpp

index d79562e..9267b55 100644 (file)
         "description": "r600/sfn: allow building with clang 6 (Android 9)",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
index 2afd2b1..7ffb8a7 100644 (file)
@@ -870,43 +870,43 @@ template <typename T> struct type_char {
 };
 
 template <> struct type_char<AluInstr> {
-   static constexpr const char value = 'A';
+   static const char value() { return 'A';};
 };
 
 template <> struct type_char<AluGroup> {
-   static constexpr const char value = 'G';
+   static const char value() { return 'G';};
 };
 
 template <> struct type_char<ExportInstr> {
-   static constexpr const char value = 'E';
+   static const char value() { return 'E';};
 };
 
 template <> struct type_char<TexInstr> {
-   static constexpr const char value = 'T';
+   static const char value() { return 'T';};
 };
 
 template <> struct type_char<FetchInstr> {
-   static constexpr const char value = 'F';
+   static const char value() { return 'F';};
 };
 
 template <> struct type_char<WriteOutInstr> {
-   static constexpr const char value = 'M';
+   static const char value() { return 'M';};
 };
 
 template <> struct type_char<MemRingOutInstr> {
-   static constexpr const char value = 'R';
+   static const char value() { return 'R';};
 };
 
 template <> struct type_char<WriteTFInstr> {
-   static constexpr const char value = 'X';
+   static const char value() { return 'X';};
 };
 
 template <> struct type_char<GDSInstr> {
-   static constexpr const char value = 'S';
+   static const char value() { return 'S';};
 };
 
 template <> struct type_char<RatInstr> {
-   static constexpr const char value = 'I';
+   static const char value() { return 'I';};
 };
 
 template <typename T>
@@ -928,7 +928,7 @@ BlockSheduler::collect_ready_type(std::list<T *>& ready, std::list<T *>& availab
    }
 
    for (auto& i : ready)
-      sfn_log << SfnLog::schedule << type_char<T>::value << ";  " << *i << "\n";
+      sfn_log << SfnLog::schedule << type_char<T>::value() << ";  " << *i << "\n";
 
    return !ready.empty();
 }