41 lines · cpp
1// RUN: %check_clang_tidy %s google-runtime-float %t2 3long double foo;4// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: 'long double' type is not portable and should not be used [google-runtime-float]5 6typedef long double MyLongDouble;7// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: 'long double' type is not portable and should not be used [google-runtime-float]8 9typedef long double MyOtherLongDouble; // NOLINT10 11template <typename T>12void tmpl() { T i; }13 14long volatile double v = 10;15// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: 'volatile long double' type is not portable and should not be used [google-runtime-float]16 17long double h(long const double aaa, long double bbb = 0.5L) {18 // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: 'long double' type is not portable and should not be used [google-runtime-float]19 // CHECK-MESSAGES: :[[@LINE-2]]:15: warning: 'const long double' type is not portable and should not be used [google-runtime-float]20 // CHECK-MESSAGES: :[[@LINE-3]]:38: warning: 'long double' type is not portable and should not be used [google-runtime-float]21 // CHECK-MESSAGES: :[[@LINE-4]]:56: warning: 'long double' type from literal suffix 'L' is not portable and should not be used [google-runtime-float]22 double x = 0.1;23 double y = 0.2L;24 // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: 'long double' type from literal suffix 'L' is not portable and should not be used [google-runtime-float]25#define ldtype long double26 ldtype z;27 tmpl<long double>();28 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: 'long double' type is not portable and should not be used [google-runtime-float]29 return 0;30}31 32struct S{};33constexpr S operator"" _baz(unsigned long long) {34 long double j;35 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'long double' type is not portable and should not be used [google-runtime-float]36 MyOtherLongDouble x;37 long int a = 1L;38 return S{};39}40 41