Skip to content

Commit 40a9136

Browse files
authored
Merge pull request #21110 from jketema/jketema/rm-decimal
C++: Remove decimal floating point types
2 parents cc4926a + f4980be commit 40a9136

File tree

20 files changed

+13662
-3872
lines changed

20 files changed

+13662
-3872
lines changed

cpp/downgrades/d2d611b3fdcc7c4fe370f0d115200a3aa6ad5837/old.dbscheme

Lines changed: 2469 additions & 0 deletions
Large diffs are not rendered by default.

cpp/downgrades/d2d611b3fdcc7c4fe370f0d115200a3aa6ad5837/semmlecode.cpp.dbscheme

Lines changed: 2469 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
description: Remove _Decimal{32,64,128} types
2+
compatibility: full
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: breaking
3+
---
4+
* The `_Decimal32`, `_Decimal64`, and `_Decimal128` types are no longer exposed as builtin types. Support for these gcc-specific types was incomplete, and are generally not used in C/C++ codebases.

cpp/ql/lib/semmle/code/cpp/Type.qll

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -802,15 +802,6 @@ private predicate floatingPointTypeMapping(
802802
// _Complex __float128
803803
kind = 39 and base = 2 and domain = TComplexDomain() and realKind = 38 and extended = false
804804
or
805-
// _Decimal32
806-
kind = 40 and base = 10 and domain = TRealDomain() and realKind = 40 and extended = false
807-
or
808-
// _Decimal64
809-
kind = 41 and base = 10 and domain = TRealDomain() and realKind = 41 and extended = false
810-
or
811-
// _Decimal128
812-
kind = 42 and base = 10 and domain = TRealDomain() and realKind = 42 and extended = false
813-
or
814805
// _Float32
815806
kind = 45 and base = 2 and domain = TRealDomain() and realKind = 45 and extended = false
816807
or
@@ -871,9 +862,8 @@ private predicate floatingPointTypeMapping(
871862

872863
/**
873864
* The C/C++ floating point types. See 4.5. This includes `float`, `double` and `long double`, the
874-
* fixed-size floating-point types like `_Float32`, the extended-precision floating-point types like
875-
* `_Float64x`, and the decimal floating-point types like `_Decimal32`. It also includes the complex
876-
* and imaginary versions of all of these types.
865+
* fixed-size floating-point types like `_Float32`, and the extended-precision floating-point types
866+
* like `_Float64x`. It also includes the complex and imaginary versions of all of these types.
877867
*/
878868
class FloatingPointType extends ArithmeticType {
879869
final int base;
@@ -991,42 +981,6 @@ class Float128Type extends RealNumberType, BinaryFloatingPointType {
991981
override string getAPrimaryQlClass() { result = "Float128Type" }
992982
}
993983

994-
/**
995-
* The GNU C `_Decimal32` primitive type. This is not standard C/C++.
996-
* ```
997-
* _Decimal32 d32;
998-
* ```
999-
*/
1000-
class Decimal32Type extends RealNumberType, DecimalFloatingPointType {
1001-
Decimal32Type() { builtintypes(underlyingElement(this), _, 40, _, _, _) }
1002-
1003-
override string getAPrimaryQlClass() { result = "Decimal32Type" }
1004-
}
1005-
1006-
/**
1007-
* The GNU C `_Decimal64` primitive type. This is not standard C/C++.
1008-
* ```
1009-
* _Decimal64 d64;
1010-
* ```
1011-
*/
1012-
class Decimal64Type extends RealNumberType, DecimalFloatingPointType {
1013-
Decimal64Type() { builtintypes(underlyingElement(this), _, 41, _, _, _) }
1014-
1015-
override string getAPrimaryQlClass() { result = "Decimal64Type" }
1016-
}
1017-
1018-
/**
1019-
* The GNU C `_Decimal128` primitive type. This is not standard C/C++.
1020-
* ```
1021-
* _Decimal128 d128;
1022-
* ```
1023-
*/
1024-
class Decimal128Type extends RealNumberType, DecimalFloatingPointType {
1025-
Decimal128Type() { builtintypes(underlyingElement(this), _, 42, _, _, _) }
1026-
1027-
override string getAPrimaryQlClass() { result = "Decimal128Type" }
1028-
}
1029-
1030984
/**
1031985
* The C/C++ `void` type. See 4.7.
1032986
* ```

cpp/ql/lib/semmlecode.cpp.dbscheme

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,9 +617,9 @@ case @builtintype.kind of
617617
| 37 = @signed_int128 // signed __int128
618618
| 38 = @float128 // __float128
619619
| 39 = @complex_float128 // _Complex __float128
620-
| 40 = @decimal32 // _Decimal32
621-
| 41 = @decimal64 // _Decimal64
622-
| 42 = @decimal128 // _Decimal128
620+
// ... 40 _Decimal32
621+
// ... 41 _Decimal64
622+
// ... 42 _Decimal128
623623
| 43 = @char16_t
624624
| 44 = @char32_t
625625
| 45 = @std_float32 // _Float32

0 commit comments

Comments
 (0)