diff libinterp/corefcn/pr-output.cc @ 25569:e8961d677661 stable

build: avoid compiler warning about unused function 'abs' (bug #54237) * pr-output.cc: Only instantiate local 'abs' function template for fixed width signed and unsigned integer types used in Octave integer array types. Avoids clang compiler warning with -Wunused-function option.
author Mike Miller <mtmiller@octave.org>
date Mon, 09 Jul 2018 19:11:23 -0700
parents 7561fb4ab972
children 4d565baa475e
line wrap: on
line diff
--- a/libinterp/corefcn/pr-output.cc	Mon Jul 09 15:53:05 2018 -0700
+++ b/libinterp/corefcn/pr-output.cc	Mon Jul 09 19:11:23 2018 -0700
@@ -1701,25 +1701,23 @@
 #define INSTANTIATE_ABS(T)                      \
   template T abs (T)
 
-INSTANTIATE_ABS(signed char);
-INSTANTIATE_ABS(short);
-INSTANTIATE_ABS(int);
-INSTANTIATE_ABS(long);
-INSTANTIATE_ABS(long long);
+INSTANTIATE_ABS(int8_t);
+INSTANTIATE_ABS(int16_t);
+INSTANTIATE_ABS(int32_t);
+INSTANTIATE_ABS(int64_t);
 
 #define SPECIALIZE_UABS(T)                      \
   template <>                                   \
-  inline unsigned T                             \
-  abs (unsigned T x)                            \
+  inline T                                      \
+  abs (T x)                                     \
   {                                             \
     return x;                                   \
   }
 
-SPECIALIZE_UABS(char)
-SPECIALIZE_UABS(short)
-SPECIALIZE_UABS(int)
-SPECIALIZE_UABS(long)
-SPECIALIZE_UABS(long long)
+SPECIALIZE_UABS(uint8_t)
+SPECIALIZE_UABS(uint16_t)
+SPECIALIZE_UABS(uint32_t)
+SPECIALIZE_UABS(uint64_t)
 
 #define MAKE_INT_MATRIX_FORMAT(TYPE)                                    \
   template <>                                                           \