From d44c60b58d36ca2a0fcb7a92baa8cf0d790477c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C3=ABl=20Van=20Canneyt?= <michael@freepascal.org>
Date: Tue, 30 May 2023 15:55:08 +0200
Subject: [PATCH] * Define RTTI visibilities

---
 rtl/inc/rttih.inc | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/rtl/inc/rttih.inc b/rtl/inc/rttih.inc
index ee4ca7946f..bae7334dbf 100644
--- a/rtl/inc/rttih.inc
+++ b/rtl/inc/rttih.inc
@@ -11,6 +11,13 @@
 
  **********************************************************************}
 
+{$IF DEFINED(CPU8) OR DEFINED(CPU16)}
+{ disable the extended RTTI for the RTL/FCL on these targets; the user can of
+  course still enable it for their own classes if needed (and published
+  properties and methods are accessible using the legacy RTTI as well) }
+{$DEFINE SMALLRTTI}
+{$ENDIF}
+
 {$PUSH}
 {$MINENUMSIZE 1   this saves a lot of memory }
 
@@ -26,6 +33,23 @@ type
               tkDynArray,tkInterfaceRaw,tkProcVar,tkUString,tkUChar,
               tkHelper,tkFile,tkClassRef,tkPointer);
 
+  TVisibilityClass = (vcPrivate, vcProtected, vcPublic, vcPublished);
+  TVisibilityClasses = set of TVisibilityClass;
+ 
+ {$MINENUMSIZE DEFAULT}
+ 
+const
+{$IFNDEF SMALLRTTI}
+  DefaultFieldRttiVisibility = [vcPrivate..vcPublished];
+  DefaultMethodRttiVisibility = [vcPublic..vcPublished];
+  DefaultPropertyRttiVisibility = [vcPublic..vcPublished];
+{$ELSE SMALLRTTI}
+  DefaultFieldRttiVisibility = [];
+  DefaultMethodRttiVisibility = [];
+  DefaultPropertyRttiVisibility = [];
+{$ENDIF SMALLRTTI}
+ 
+
 {$POP}
 
 const