소스 검색

Changing compiler to Clang/bcc32c

- regarding the ILINK_LibraryPath for Cfg_1_Win32 (Debug):
Win32\Debug (not only Win32c\Debug) needs to be before Win32c\Release, as win32c does not include debug builds of Pascal code - so without that VCL debugging won't work
- IDE insist on adding CC_Suffix to all projects once switched to Clang, although it is only used in WinSCP.cbproj
- UNICODE define: Not needed for build (it's implicit), but CodeInsight does not know it it somehow

Source commit: da06d73eb86caff5ca9cac0185bed54da0da8f07
Martin Prikryl 1 개월 전
부모
커밋
1d9fe8c955
46개의 변경된 파일150개의 추가작업 그리고 69개의 파일을 삭제
  1. 8 6
      libs/Makefile.inc
  2. 1 2
      libs/expat/bcb5/expat_static.mak
  3. 0 1
      libs/expat/lib/winconfig.h
  4. 1 1
      libs/libs3/Makefile
  5. 3 3
      libs/mfc/source/borland.mak
  6. 1 1
      libs/neon/Makefile.bcb
  7. 3 0
      libs/neon/src/ne_socket.h
  8. 1 1
      libs/openssl/Makefile
  9. 1 0
      source/Console.cbproj
  10. 3 0
      source/DScpComp.cbproj
  11. 2 0
      source/DragDropP.cbproj
  12. 1 0
      source/DragExt.cbproj
  13. 2 4
      source/DriveDir.cbproj
  14. 9 11
      source/FileZilla.cbproj
  15. 2 1
      source/Jcl.cbproj
  16. 2 0
      source/My.cbproj
  17. 2 1
      source/PngComponents.cbproj
  18. 3 24
      source/Putty.cbproj
  19. 4 1
      source/RScpComp.cbproj
  20. 9 2
      source/ScpCore.cbproj
  21. 9 1
      source/ScpForms.cbproj
  22. 9 0
      source/ScpResources.cbproj
  23. 12 4
      source/WinSCP.cbproj
  24. 3 0
      source/core/Common.cpp
  25. 3 0
      source/core/Configuration.cpp
  26. 3 0
      source/core/Cryptography.cpp
  27. 1 0
      source/core/FileOperationProgress.h
  28. 2 1
      source/core/Global.h
  29. 3 0
      source/core/Http.cpp
  30. 2 0
      source/core/Interface.h
  31. 3 0
      source/core/NeonIntf.cpp
  32. 3 0
      source/core/PuttyIntf.cpp
  33. 6 0
      source/core/PuttyIntf.h
  34. 1 1
      source/core/Queue.cpp
  35. 2 0
      source/core/RemoteFiles.h
  36. 3 0
      source/core/S3FileSystem.h
  37. 1 1
      source/core/SecureShell.cpp
  38. 1 0
      source/core/SessionInfo.h
  39. 3 0
      source/core/Terminal.cpp
  40. 3 0
      source/filezilla/FilezillaTools.h
  41. 2 0
      source/tb2k.cbproj
  42. 2 0
      source/tbxp.cbproj
  43. 3 2
      source/windows/GUITools.cpp
  44. 6 0
      source/windows/GUITools.h
  45. 1 0
      source/windows/WinConfiguration.h
  46. 5 0
      source/windows/WinInterface.cpp

+ 8 - 6
libs/Makefile.inc

@@ -1,7 +1,9 @@
-CC = "$(BDS)\bin\bcc32"
+CC = "$(BDS)\bin\bcc32c"
 MKLIB = "$(BDS)\bin\tlib" /a /C
-CFLAG_BASE=-O2 -c -fp -tWM
-# These are defaults anyway
-CFLAG_BASE=$(CFLAG_BASE) -a8 -vi -ff
-CFLAG_COMMON=$(CFLAG_BASE)
-CFLAG_CPP=$(CFLAG_BASE) /P
+CFLAG_BASE = -cc1 -nobuiltininc -nostdsysteminc -triple i686-pc-windows-omf -emit-obj -mrelocation-model static -masm-verbose -mstack-alignment=16 -O2 -tM -tW -fborland-extensions
+CFLAG_BASE = $(CFLAG_BASE) -isystem "$(BDS)/include/windows/crtl" -isystem "$(BDS)/include/windows/sdk" -isystem "$(BDS)/include/dinkumware64"
+CFLAG_COMMON = $(CFLAG_BASE) -std=c99 -x c -fno-threadsafe-statics
+CFLAG_CPP = $(CFLAG_BASE) -x c++ -std=c++17 -fcxx-exceptions -ffunction-sections -fno-use-cxa-atexit
+
+# Debug:
+# CFLAG_CPP=$(CFLAG_CPP) -D_DEBUG -debug-info-kind=standalone

+ 1 - 2
libs/expat/bcb5/expat_static.mak

@@ -11,7 +11,6 @@ OBJFILES = \
 # ---------------------------------------------------------------------------
 DEFINES = _WINDOWS;WIN32;NDEBUG;_LIB;XML_STATIC;WINSCP;_NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL
 INCLUDEPATH = ..;..\lib
-WARNINGS = -w-rch -w-par -w-8027 -w-8026 -w-ccc -w-8012
 CFLAG1 = $(CFLAG_COMMON)
 # ---------------------------------------------------------------------------
 .autodepend
@@ -23,5 +22,5 @@ $(PROJECT): $(OBJFILES)
 # ---------------------------------------------------------------------------
 .path.c = ..\lib
 .c.obj:
-    $(CC) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH:;= -I) $(DEFINESARGS) -o $@ $<
+    $(CC) $(CFLAG1) -I$(INCLUDEPATH:;= -I) $(DEFINESARGS) -o $@ $<
 # ---------------------------------------------------------------------------

+ 0 - 1
libs/expat/lib/winconfig.h

@@ -45,6 +45,5 @@
 #include <memory.h>
 #include <string.h>
 #include <float.h>
-#define isnan _isnan
 
 #endif /* ndef WINCONFIG_H */

+ 1 - 1
libs/libs3/Makefile

@@ -2,7 +2,7 @@
 
 # Set your compiler options
 DEFINES = WIN32;WIN32_LEAN_AND_MEAN;WINSCP;NE_LFS
-WARNINGS = -w-aus -w-par
+WARNINGS = -Wno-deprecated-declarations
 # Compile like C++
 CFLAG = $(CFLAG_CPP) -D$(DEFINES:;= -D) $(WARNINGS)
 # The output directory for all the temporary muck

+ 3 - 3
libs/mfc/source/borland.mak

@@ -17,8 +17,8 @@ GOAL=$(MODEL)afxc$(BASE)
 #
 # COMPILER OPTIONS
 #
-# -VF4 Support MFC 4.0
-CL_OPT=-VF4 -w-
+WARNINGS=-Wno-extra-tokens -Wno-extern-initializer -Wno-varargs
+CL_OPT=$(WARNINGS)
 
 #############################################################################
 # Library Components
@@ -43,7 +43,7 @@ OBJS=$(CPP_OBJS)
 
 CPPFLAGS=$(CFLAG_CPP) $(CL_OPT) -D$(DEFS:;= -D)
 
-BORFLAGS=$(CPPFLAGS) -I$(INCL:;= -I)
+BORFLAGS=$(CPPFLAGS) -I$(INCL:;= -I) -isystem "$(BDS)/include/windows/rtl"
 
 .SUFFIXES: .cpp
 

+ 1 - 1
libs/neon/Makefile.bcb

@@ -5,7 +5,7 @@ OPENSSL_DEFINES=OPENSSL_SYSNAME_WIN32;L_ENDIAN;DSO_WIN32;BN_ASM;MD5_ASM;SHA1_ASM
 EXPAT_DEFINES=COMPILED_FROM_DSP;XML_STATIC
 DEFINES=WIN32;WIN32_LEAN_AND_MEAN;_WINDOWS;WIN32;NDEBUG;_LIB;_NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL;NE_HAVE_SSL;HAVE_OPENSSL;HAVE_EXPAT;HAVE_EXPAT_H;NE_HAVE_DAV;NE_LFS;NOUSER;NOGDI;HAVE_STRTOLL;WINSCP
 ALLDEFINES=$(OPENSSL_DEFINES);$(EXPAT_DEFINES);$(DEFINES)
-WARNINGS=-w-ccc -w-rch -w-pia -w-aus -w-par -w-inl -w-eff -w-sus -w-dup -w-spa -w-csu -w-rvl -w-8065 -w-8069
+WARNINGS=-Wno-typedef-redefinition -Wno-incompatible-pointer-types
 CFLAG=$(CFLAG_COMMON) $(WARNINGS)
 
 # neon directory

+ 3 - 0
libs/neon/src/ne_socket.h

@@ -343,7 +343,10 @@ int ne_sock_proxy(ne_socket *sock, enum ne_sock_sversion vers,
 
 // WINSCP
 void ne_sock_set_buffers(ne_socket *sock, unsigned int sndbuf);
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreserved-id-macro"
 #include <openssl/ssl.h>
+#pragma clang diagnostic pop
 void ne_init_ssl_session(SSL *ssl, void *userdata);
 int ne_sock_sspi_init(void);
 

+ 1 - 1
libs/openssl/Makefile

@@ -17,7 +17,7 @@
 
 # Set your compiler options
 
-CFLAG_WARNINGS=-w-ccc -w-rch -w-pia -w-aus -w-par -w-inl -w-eff -w-sus -w-dup -w-spa -w-csu -w-rvl
+CFLAG_WARNINGS=-Wno-incompatible-function-pointer-types -Wno-deprecated-declarations
 CFLAG=$(CFLAG_COMMON) $(CFLAG_WARNINGS)
 
 DEFINES=MD5_ASM;SHA1_ASM;SHA256_ASM;SHA512_ASM;RMD160_ASM

+ 1 - 0
source/Console.cbproj

@@ -8,6 +8,7 @@
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>1</TargetedPlatforms>
         <AppType>Console</AppType>
+        <CC_Suffix Condition="'$(CC_Suffix)'==''">c</CC_Suffix>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>

+ 3 - 0
source/DScpComp.cbproj

@@ -9,6 +9,7 @@
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>1</TargetedPlatforms>
         <AppType>Package</AppType>
+        <CC_Suffix Condition="'$(CC_Suffix)'==''">c</CC_Suffix>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
@@ -46,6 +47,8 @@
         <BCC_AllWarnings>true</BCC_AllWarnings>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
+        <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
+        <BCC_UserSuppliedOptions>-Wno-ignored-attributes -Wno-zero-as-null-pointer-constant -Wno-c++98-compat-pedantic -Wno-language-extension-token -Wno-missing-prototypes -Wno-old-style-cast -Wno-padded</BCC_UserSuppliedOptions>
         <BPILibOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</BPILibOutputDir>
         <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
         <DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Vcl;$(DCC_Namespace)</DCC_Namespace>

+ 2 - 0
source/DragDropP.cbproj

@@ -9,6 +9,7 @@
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>1</TargetedPlatforms>
         <AppType>Package</AppType>
+        <CC_Suffix Condition="'$(CC_Suffix)'==''">c</CC_Suffix>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
@@ -32,6 +33,7 @@
         <_TCHARMapping>wchar_t</_TCHARMapping>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
+        <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
         <BPILibOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</BPILibOutputDir>
         <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
         <DCC_CVT_ACHAR_TO_WCHAR>true</DCC_CVT_ACHAR_TO_WCHAR>

+ 1 - 0
source/DragExt.cbproj

@@ -8,6 +8,7 @@
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>3</TargetedPlatforms>
         <AppType>Library</AppType>
+        <CC_Suffix Condition="'$(CC_Suffix)'==''">c</CC_Suffix>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>

+ 2 - 4
source/DriveDir.cbproj

@@ -9,6 +9,7 @@
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>1</TargetedPlatforms>
         <AppType>Package</AppType>
+        <CC_Suffix Condition="'$(CC_Suffix)'==''">c</CC_Suffix>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
@@ -32,6 +33,7 @@
         <_TCHARMapping>wchar_t</_TCHARMapping>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
+        <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
         <BPILibOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</BPILibOutputDir>
         <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
         <DCC_CVT_ACHAR_TO_WCHAR>true</DCC_CVT_ACHAR_TO_WCHAR>
@@ -150,10 +152,6 @@
             <BuildOrder>26</BuildOrder>
             <IgnorePath>true</IgnorePath>
         </LibFiles>
-        <PackageImport Include="bcbie.bpi">
-            <BuildOrder>68</BuildOrder>
-            <BuildOrder>12</BuildOrder>
-        </PackageImport>
         <PackageImport Include="DragDropP.bpi">
             <BuildOrder>25</BuildOrder>
         </PackageImport>

+ 9 - 11
source/FileZilla.cbproj

@@ -8,6 +8,7 @@
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>1</TargetedPlatforms>
         <AppType>StaticLibrary</AppType>
+        <CC_Suffix Condition="'$(CC_Suffix)'==''">c</CC_Suffix>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
@@ -31,19 +32,12 @@
         <_TCHARMapping>wchar_t</_TCHARMapping>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
-        <BCC_waus>false</BCC_waus>
-        <BCC_wccc>false</BCC_wccc>
-        <BCC_wcom>false</BCC_wcom>
-        <BCC_wcpt>false</BCC_wcpt>
-        <BCC_wcsu>false</BCC_wcsu>
-        <BCC_whid>false</BCC_whid>
-        <BCC_wovf>false</BCC_wovf>
-        <BCC_wpar>false</BCC_wpar>
-        <BCC_wpia>false</BCC_wpia>
-        <BCC_wrch>false</BCC_wrch>
+        <BCC_PCHName_Clang>filezilla\FileZillaPCH.h</BCC_PCHName_Clang>
+        <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
+        <BCC_UserSuppliedOptions>-Wno-ignored-attributes -Wno-dangling-else -Wno-extra-tokens</BCC_UserSuppliedOptions>
         <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
         <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;$(DCC_Namespace)</DCC_Namespace>
-        <Defines>WINSCP;WIN32;$(Defines)</Defines>
+        <Defines>WINSCP;WIN32;UNICODE;$(Defines)</Defines>
         <FinalOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</FinalOutputDir>
         <ILINK_LibraryPath>$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;$(ILINK_LibraryPath)</ILINK_LibraryPath>
         <IncludePath>filezilla\misc\;filezilla\;resource;core;..\libs\openssl\include;..\libs\mfc\include;$(BDS)\include;$(BDS)\include\windows\vcl;$(IncludePath)</IncludePath>
@@ -145,6 +139,10 @@
             <Key>Cfg_2</Key>
             <CfgParent>Base</CfgParent>
         </BuildConfiguration>
+        <PCHCompile Include="filezilla\FileZillaPCH.h">
+            <BuildOrder>16</BuildOrder>
+            <PCH>true</PCH>
+        </PCHCompile>
     </ItemGroup>
     <Import Condition="Exists('$(BDS)\Bin\CodeGear.Cpp.Targets')" Project="$(BDS)\Bin\CodeGear.Cpp.Targets"/>
     <ProjectExtensions>

+ 2 - 1
source/Jcl.cbproj

@@ -9,6 +9,7 @@
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>1</TargetedPlatforms>
         <AppType>Package</AppType>
+        <CC_Suffix Condition="'$(CC_Suffix)'==''">c</CC_Suffix>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
@@ -37,7 +38,7 @@
         <_TCHARMapping>char</_TCHARMapping>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
-        <BCC_wpar>false</BCC_wpar>
+        <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
         <BPILibOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</BPILibOutputDir>
         <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
         <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>

+ 2 - 0
source/My.cbproj

@@ -9,6 +9,7 @@
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>1</TargetedPlatforms>
         <AppType>Package</AppType>
+        <CC_Suffix Condition="'$(CC_Suffix)'==''">c</CC_Suffix>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
@@ -32,6 +33,7 @@
         <_TCHARMapping>wchar_t</_TCHARMapping>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
+        <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
         <BPILibOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</BPILibOutputDir>
         <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
         <DCC_CVT_ACHAR_TO_WCHAR>true</DCC_CVT_ACHAR_TO_WCHAR>

+ 2 - 1
source/PngComponents.cbproj

@@ -9,6 +9,7 @@
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>1</TargetedPlatforms>
         <AppType>Package</AppType>
+        <CC_Suffix Condition="'$(CC_Suffix)'==''">c</CC_Suffix>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
@@ -37,7 +38,7 @@
         <_TCHARMapping>char</_TCHARMapping>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
-        <BCC_wpar>false</BCC_wpar>
+        <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
         <BPILibOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</BPILibOutputDir>
         <DCC_AdditionalSwitches>-LUDesignIDE</DCC_AdditionalSwitches>
         <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>

+ 3 - 24
source/Putty.cbproj

@@ -8,6 +8,7 @@
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>1</TargetedPlatforms>
         <AppType>StaticLibrary</AppType>
+        <CC_Suffix Condition="'$(CC_Suffix)'==''">c</CC_Suffix>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
@@ -31,30 +32,8 @@
         <AllPackageLibs>rtl.lib</AllPackageLibs>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
-        <BCC_wamb>true</BCC_wamb>
-        <BCC_wamp>true</BCC_wamp>
-        <BCC_wasm>true</BCC_wasm>
-        <BCC_waus>false</BCC_waus>
-        <BCC_wbbf>false</BCC_wbbf>
-        <BCC_wccc>false</BCC_wccc>
-        <BCC_wcln>true</BCC_wcln>
-        <BCC_wcsu>false</BCC_wcsu>
-        <BCC_wdef>true</BCC_wdef>
-        <BCC_weff>false</BCC_weff>
-        <BCC_wexc>true</BCC_wexc>
-        <BCC_wimp>true</BCC_wimp>
-        <BCC_wnak>true</BCC_wnak>
-        <BCC_wnod>true</BCC_wnod>
-        <BCC_wntn>true</BCC_wntn>
-        <BCC_wpad>true</BCC_wpad>
-        <BCC_wpar>false</BCC_wpar>
-        <BCC_wpch>false</BCC_wpch>
-        <BCC_wpia>false</BCC_wpia>
-        <BCC_wrch>false</BCC_wrch>
-        <BCC_wrvl>false</BCC_wrvl>
-        <BCC_wstl>true</BCC_wstl>
-        <BCC_wstv>true</BCC_wstv>
-        <BCC_wsus>false</BCC_wsus>
+        <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
+        <BCC_UserSuppliedOptions>-Wno-typedef-redefinition</BCC_UserSuppliedOptions>
         <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
         <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;$(DCC_Namespace)</DCC_Namespace>
         <Defines>SECURITY_WIN32;WINSCP;MPEXT;PLATFORM_HAS_SMEMCLR;_WINDOWS;$(Defines)</Defines>

+ 4 - 1
source/RScpComp.cbproj

@@ -8,6 +8,7 @@
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>1</TargetedPlatforms>
         <AppType>StaticLibrary</AppType>
+        <CC_Suffix Condition="'$(CC_Suffix)'==''">c</CC_Suffix>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
@@ -33,9 +34,11 @@
         <BCC_AllWarnings>true</BCC_AllWarnings>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
-        <BCC_wdiu>false</BCC_wdiu>
+        <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
+        <BCC_UserSuppliedOptions>-Wno-ignored-attributes -Wno-zero-as-null-pointer-constant -Wno-c++98-compat-pedantic -Wno-language-extension-token -Wno-missing-prototypes -Wno-old-style-cast -Wno-padded -Wno-float-equal</BCC_UserSuppliedOptions>
         <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
         <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;$(DCC_Namespace)</DCC_Namespace>
+        <Defines>UNICODE;$(Defines)</Defines>
         <FinalOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</FinalOutputDir>
         <ILINK_LibraryPath>$(BDS)\lib;$(ILINK_LibraryPath)</ILINK_LibraryPath>
         <IncludePath>components\;core;windows;packages\filemng;packages\dragndrop;packages\my;packages\tb2k;packages\tbx;$(BDS)\include;$(BDS)\include\windows\vcl;$(IncludePath)</IncludePath>

+ 9 - 2
source/ScpCore.cbproj

@@ -8,6 +8,7 @@
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>1</TargetedPlatforms>
         <AppType>StaticLibrary</AppType>
+        <CC_Suffix Condition="'$(CC_Suffix)'==''">c</CC_Suffix>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
@@ -33,10 +34,12 @@
         <BCC_AllWarnings>true</BCC_AllWarnings>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
-        <BCC_wdiu>false</BCC_wdiu>
+        <BCC_PCHName_Clang>core\CorePCH.h</BCC_PCHName_Clang>
+        <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
+        <BCC_UserSuppliedOptions>-Wno-objc-interface-ivars -Wno-return-type-c-linkage -Wno-covered-switch-default -Wno-cast-align -Wno-implicit-fallthrough -Wno-missing-prototypes -Wno-switch -Wno-shadow -Wno-sign-conversion -Wno-global-constructors -Wno-exit-time-destructors -Wno-padded -Wno-c++98-compat-pedantic -Wno-zero-as-null-pointer-constant -Wno-language-extension-token -Wno-old-style-cast -Wno-ignored-attributes -Wno-float-equal -Wno-switch-enum</BCC_UserSuppliedOptions>
         <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
         <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;$(DCC_Namespace)</DCC_Namespace>
-        <Defines>WINSCP;_WINDOWS;WIN32;WINNT;OPENSSL_NO_DEPRECATED_1_1_0;_CRTIMP=;_LIB;$(BUILD_TYPE);$(Defines)</Defines>
+        <Defines>WINSCP;_WINDOWS;WIN32;WINNT;OPENSSL_NO_DEPRECATED_1_1_0;_CRTIMP=;_LIB;UNICODE;$(BUILD_TYPE);$(Defines)</Defines>
         <FinalOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</FinalOutputDir>
         <ILINK_LibraryPath>$(BDS)\lib;$(ILINK_LibraryPath)</ILINK_LibraryPath>
         <IncludePath>core\;putty;putty\windows;filezilla;resource;..\libs\openssl\include;..\libs\expat\lib;..\libs\neon\src;..\libs\libs3\inc;..\libs\mfc\include;$(BDS)\include;$(BDS)\include\windows\vcl;$(IncludePath)</IncludePath>
@@ -217,6 +220,10 @@
             <Key>Cfg_2</Key>
             <CfgParent>Base</CfgParent>
         </BuildConfiguration>
+        <PCHCompile Include="core\CorePCH.h">
+            <BuildOrder>33</BuildOrder>
+            <PCH>true</PCH>
+        </PCHCompile>
     </ItemGroup>
     <Import Condition="Exists('$(BDS)\Bin\CodeGear.Cpp.Targets')" Project="$(BDS)\Bin\CodeGear.Cpp.Targets"/>
     <ProjectExtensions>

+ 9 - 1
source/ScpForms.cbproj

@@ -8,6 +8,7 @@
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>1</TargetedPlatforms>
         <AppType>StaticLibrary</AppType>
+        <CC_Suffix Condition="'$(CC_Suffix)'==''">c</CC_Suffix>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
@@ -28,9 +29,12 @@
         <BCC_AllWarnings>true</BCC_AllWarnings>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
-        <BCC_wdiu>false</BCC_wdiu>
+        <BCC_PCHName_Clang>forms\FormsPCH.h</BCC_PCHName_Clang>
+        <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
+        <BCC_UserSuppliedOptions>-Wno-objc-interface-ivars -Wno-return-type-c-linkage -Wno-covered-switch-default -Wno-cast-align -Wno-implicit-fallthrough -Wno-missing-prototypes -Wno-switch -Wno-shadow -Wno-sign-conversion -Wno-global-constructors -Wno-exit-time-destructors -Wno-padded -Wno-c++98-compat-pedantic -Wno-zero-as-null-pointer-constant -Wno-language-extension-token -Wno-old-style-cast -Wno-ignored-attributes -Wno-float-equal -Wno-switch-enum</BCC_UserSuppliedOptions>
         <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
         <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;$(DCC_Namespace)</DCC_Namespace>
+        <Defines>UNICODE;$(Defines)</Defines>
         <FinalOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</FinalOutputDir>
         <IncludePath>windows\;forms\;core;components;resource;packages\filemng;packages\dragndrop;packages\my;packages\tb2k;packages\tbx;packages\png;packages\jcl;$(BDS)\include\windows;$(BDS)\include\windows\vcl;$(IncludePath)</IncludePath>
         <IntermediateOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</IntermediateOutputDir>
@@ -341,6 +345,10 @@
             <Key>Cfg_2</Key>
             <CfgParent>Base</CfgParent>
         </BuildConfiguration>
+        <PCHCompile Include="forms\FormsPCH.h">
+            <BuildOrder>38</BuildOrder>
+            <PCH>true</PCH>
+        </PCHCompile>
     </ItemGroup>
     <Import Condition="Exists('$(BDS)\Bin\CodeGear.Cpp.Targets')" Project="$(BDS)\Bin\CodeGear.Cpp.Targets"/>
     <ProjectExtensions>

+ 9 - 0
source/ScpResources.cbproj

@@ -8,6 +8,7 @@
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>1</TargetedPlatforms>
         <AppType>StaticLibrary</AppType>
+        <CC_Suffix Condition="'$(CC_Suffix)'==''">c</CC_Suffix>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
@@ -27,8 +28,12 @@
         <BCC_AllWarnings>true</BCC_AllWarnings>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
+        <BCC_PCHName_Clang>forms\ResourcesPCH.h</BCC_PCHName_Clang>
+        <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
+        <BCC_UserSuppliedOptions>-Wno-objc-interface-ivars -Wno-return-type-c-linkage -Wno-covered-switch-default -Wno-cast-align -Wno-implicit-fallthrough -Wno-missing-prototypes -Wno-switch -Wno-shadow -Wno-sign-conversion -Wno-global-constructors -Wno-exit-time-destructors -Wno-padded -Wno-c++98-compat-pedantic -Wno-zero-as-null-pointer-constant -Wno-language-extension-token -Wno-old-style-cast -Wno-ignored-attributes -Wno-float-equal -Wno-switch-enum</BCC_UserSuppliedOptions>
         <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
         <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
+        <Defines>UNICODE;$(Defines)</Defines>
         <FinalOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</FinalOutputDir>
         <IncludePath>core\;forms\;windows\;packages\my;packages\png;packages\tb2k;packages\tbx;$(BDS)\include\windows;$(BDS)\include\windows\vcl;$(IncludePath)</IncludePath>
         <IntermediateOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</IntermediateOutputDir>
@@ -138,6 +143,10 @@
             <Key>Cfg_2</Key>
             <CfgParent>Base</CfgParent>
         </BuildConfiguration>
+        <PCHCompile Include="forms\ResourcesPCH.h">
+            <BuildOrder>8</BuildOrder>
+            <PCH>true</PCH>
+        </PCHCompile>
     </ItemGroup>
     <Import Condition="Exists('$(BDS)\Bin\CodeGear.Cpp.Targets')" Project="$(BDS)\Bin\CodeGear.Cpp.Targets"/>
     <ProjectExtensions>

+ 12 - 4
source/WinSCP.cbproj

@@ -9,6 +9,7 @@
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>1</TargetedPlatforms>
         <AppType>Application</AppType>
+        <CC_Suffix Condition="'$(CC_Suffix)'==''">c</CC_Suffix>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
@@ -53,14 +54,16 @@
         <BCC_AllWarnings>true</BCC_AllWarnings>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
-        <BCC_wdiu>false</BCC_wdiu>
+        <BCC_PCHName_Clang>windows\WinPCH.h</BCC_PCHName_Clang>
+        <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
+        <BCC_UserSuppliedOptions>-Wno-objc-interface-ivars -Wno-return-type-c-linkage -Wno-covered-switch-default -Wno-cast-align -Wno-implicit-fallthrough -Wno-missing-prototypes -Wno-switch -Wno-shadow -Wno-sign-conversion -Wno-global-constructors -Wno-exit-time-destructors -Wno-padded -Wno-c++98-compat-pedantic -Wno-zero-as-null-pointer-constant -Wno-language-extension-token -Wno-old-style-cast -Wno-ignored-attributes -Wno-float-equal -Wno-switch-enum</BCC_UserSuppliedOptions>
         <BRCC_CodePage>65001</BRCC_CodePage>
         <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
         <DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Vcl;$(DCC_Namespace)</DCC_Namespace>
         <DCC_SYMBOL_DEPRECATED>false</DCC_SYMBOL_DEPRECATED>
         <DCC_SYMBOL_PLATFORM>false</DCC_SYMBOL_PLATFORM>
         <DCC_UNSUPPORTED_CONSTRUCT>false</DCC_UNSUPPORTED_CONSTRUCT>
-        <Defines>WINSCP;STRICT;$(Defines)</Defines>
+        <Defines>WINSCP;STRICT;UNICODE;$(Defines)</Defines>
         <FinalOutputDir>$(FINAL_PATH)\$(Platform)\$(Config)</FinalOutputDir>
         <Icon_MainIcon>resource\Application.ico</Icon_MainIcon>
         <ILINK_GenerateDRC>True</ILINK_GenerateDRC>
@@ -92,6 +95,7 @@
         <BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>
         <BCC_StackFrames>true</BCC_StackFrames>
         <BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>
+        <BT_BuildType>Debug</BT_BuildType>
         <DCC_DebugDCUs>true</DCC_DebugDCUs>
         <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
         <DCC_Define>DEBUG</DCC_Define>
@@ -104,7 +108,7 @@
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
         <ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>
-        <ILINK_LibraryPath>$(INTERM_PATH)\Win32\Debug\;$(INTERM_PATH)\Win32\;$(BDS)\lib\Win32\Debug\;$(BDS)\lib\Win32\Release\;$(BDS)\lib\Win32\Release\psdk\;$(ILINK_LibraryPath)</ILINK_LibraryPath>
+        <ILINK_LibraryPath>$(INTERM_PATH)\Win32\Debug\;$(INTERM_PATH)\Win32\;$(BDS)\lib\Win32$(CC_Suffix)\Debug\;$(BDS)\lib\Win32\Debug\;$(BDS)\lib\Win32$(CC_Suffix)\Release\;$(BDS)\lib\Win32$(CC_Suffix)\Release\psdk\;$(ILINK_LibraryPath)</ILINK_LibraryPath>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
         <ILINK_LibraryPath>$(INTERM_PATH)\Win64\Debug\;$(INTERM_PATH)\Win64\;$(BDS)\lib\Win64\Debug\;$(BDS)\lib\Win64\Release\;$(BDS)\lib\Win64\Release\psdk\;$(ILINK_LibraryPath)</ILINK_LibraryPath>
@@ -114,7 +118,7 @@
         <TASM_Debugging>None</TASM_Debugging>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
-        <ILINK_LibraryPath>$(INTERM_PATH)\Win32\Release\;$(INTERM_PATH)\Win32\;$(BDS)\lib\Win32\Release\;$(BDS)\lib\Win32\Release\psdk\;$(ILINK_LibraryPath)</ILINK_LibraryPath>
+        <ILINK_LibraryPath>$(INTERM_PATH)\Win32\Release\;$(INTERM_PATH)\Win32\;$(BDS)\lib\Win32$(CC_Suffix)\Release\;$(BDS)\lib\Win32$(CC_Suffix)\Release\psdk\;$(ILINK_LibraryPath)</ILINK_LibraryPath>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
         <ILINK_LibraryPath>$(INTERM_PATH)\Win64\Release\;$(INTERM_PATH)\Win64\;$(BDS)\lib\Win64\Release\;$(BDS)\lib\Win64\Release\psdk\;$(ILINK_LibraryPath)</ILINK_LibraryPath>
@@ -280,6 +284,10 @@
             <Key>Cfg_2</Key>
             <CfgParent>Base</CfgParent>
         </BuildConfiguration>
+        <PCHCompile Include="windows\WinPCH.h">
+            <BuildOrder>35</BuildOrder>
+            <PCH>true</PCH>
+        </PCHCompile>
     </ItemGroup>
     <Import Condition="Exists('$(BDS)\Bin\CodeGear.Cpp.Targets')" Project="$(BDS)\Bin\CodeGear.Cpp.Targets"/>
     <ProjectExtensions>

+ 3 - 0
source/core/Common.cpp

@@ -10,10 +10,13 @@
 #include <psapi.h>
 #include <SessionInfo.h>
 #include <Soap.EncdDecd.hpp>
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreserved-id-macro"
 #include <openssl/pkcs12.h>
 #include <openssl/pem.h>
 #include <openssl/err.h>
 #include <openssl/ssl.h>
+#pragma clang diagnostic pop
 //---------------------------------------------------------------------------
 const wchar_t * DSTModeNames = L"Win;Unix;Keep";
 //---------------------------------------------------------------------------

+ 3 - 0
source/core/Configuration.cpp

@@ -1181,7 +1181,10 @@ bool __fastcall TConfiguration::GetIsUnofficial()
 //---------------------------------------------------------------------------
 static TDateTime GetBuildDate()
 {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdate-time"
   UnicodeString BuildDateStr = __DATE__;
+#pragma clang diagnostic pop
   UnicodeString MonthStr = CutToChar(BuildDateStr, L' ', true);
   int Month = ParseShortEngMonthName(MonthStr);
   int Day = StrToInt(CutToChar(BuildDateStr, L' ', true));

+ 3 - 0
source/core/Cryptography.cpp

@@ -6,9 +6,12 @@
 #include "Cryptography.h"
 #include "FileBuffer.h"
 #include "Exceptions.h"
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreserved-id-macro"
 #include <openssl\rand.h>
 #include <openssl\err.h>
 #include <openssl\ssl.h>
+#pragma clang diagnostic pop
 #include <process.h>
 #include <Soap.EncdDecd.hpp>
 

+ 1 - 0
source/core/FileOperationProgress.h

@@ -168,6 +168,7 @@ public:
     TFileOperationProgressEvent AOnProgress, TFileOperationFinished AOnFinished,
     TFileOperationProgressType * Parent = NULL);
   __fastcall ~TFileOperationProgressType();
+  TFileOperationProgressType & operator =(const TFileOperationProgressType &) = default;
   void __fastcall Assign(const TFileOperationProgressType & Other);
   void __fastcall AssignButKeepSuspendState(const TFileOperationProgressType & Other);
   void __fastcall AddLocallyUsed(__int64 ASize);

+ 2 - 1
source/core/Global.h

@@ -49,7 +49,8 @@ private:
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 #include <assert.h>
-#define ACCESS_VIOLATION_TEST { (*((volatile int*)NULL)) = 0; }
+// Mere write to constant null pointer would be optimized out by Clang, so we need to calculate one
+#define ACCESS_VIOLATION_TEST { (*strchr(const_cast<char *>(""), 'a')) = 0; }
 #if defined(_DEBUG) && !defined(DESIGN_ONLY)
 #define DODEBUGGING
 #endif

+ 3 - 0
source/core/Http.cpp

@@ -6,7 +6,10 @@
 #include "NeonIntf.h"
 #include "Exceptions.h"
 #include "ne_request.h"
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreserved-id-macro"
 #include <openssl/ssl.h>
+#pragma clang diagnostic pop
 //---------------------------------------------------------------------------
 const int BasicHttpResponseLimit = 102400;
 //---------------------------------------------------------------------------

+ 2 - 0
source/core/Interface.h

@@ -116,6 +116,8 @@ struct TQueryParams
   TQueryParams(unsigned int AParams = 0, UnicodeString AHelpKeyword = HELP_NONE);
   TQueryParams(const TQueryParams & Source);
 
+  TQueryParams & operator =(const TQueryParams &) = default;
+
   void Assign(const TQueryParams & Source);
 
   const TQueryButtonAlias * Aliases;

+ 3 - 0
source/core/NeonIntf.cpp

@@ -6,12 +6,15 @@
 #include "Security.h"
 #include "Terminal.h"
 #include "Cryptography.h"
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreserved-id-macro"
 extern "C"
 {
 #include <ne_redirect.h>
 #include <ne_auth.h>
 }
 #include <openssl/ssl.h>
+#pragma clang diagnostic pop
 //---------------------------------------------------------------------------
 #define SESSION_PROXY_AUTH_KEY "proxyauth"
 #define SESSION_TLS_INIT_KEY "tlsinit"

+ 3 - 0
source/core/PuttyIntf.cpp

@@ -337,7 +337,10 @@ size_t banner(Seat * seat, const void * data, size_t len)
 NORETURN static void SSHFatalError(const char * Format, va_list Param)
 {
   char Buf[200];
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-nonliteral"
   vsnprintf(Buf, LENOF(Buf), Format, Param);
+#pragma clang diagnostic pop
   Buf[LENOF(Buf) - 1] = '\0';
 
   // Only few calls from putty\winnet.c might be connected with specific

+ 6 - 0
source/core/PuttyIntf.h

@@ -10,11 +10,16 @@ void __fastcall DontSaveRandomSeed();
 #include "PuttyTools.h"
 //---------------------------------------------------------------------------
 #define MPEXT
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wconversion"
 extern "C"
 {
 #include <putty.h>
 // To rename ssh1_cipheralg::new member, what is a keyword in C++
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wkeyword-macro"
 #define new _new_
+#pragma clang diagnostic pop
 #include <ssh.h>
 #undef new
 #include <puttyexp.h>
@@ -26,6 +31,7 @@ extern "C"
 // Defined in marshal.h - Conflicts with xml.xmldom.hpp
 #undef get_data
 }
+#pragma clang diagnostic pop
 //---------------------------------------------------------------------------
 UnicodeString GetCipherName(const ssh_cipher * Cipher);
 UnicodeString GetCompressorName(const ssh_compressor * Compressor);

+ 1 - 1
source/core/Queue.cpp

@@ -1212,7 +1212,7 @@ __fastcall TBackgroundTerminal::TBackgroundTerminal(TTerminal * MainTerminal,
   ActionLog->Enabled = false;
 }
 //---------------------------------------------------------------------------
-bool __fastcall TBackgroundTerminal::DoQueryReopen(Exception * /*E*/)
+bool __fastcall TBackgroundTerminal::DoQueryReopen(Exception *)
 {
   bool Result;
   if (FItem->IsCancelled())

+ 2 - 0
source/core/RemoteFiles.h

@@ -23,6 +23,7 @@ class TRemoteToken
 {
 public:
   __fastcall TRemoteToken();
+  TRemoteToken(const TRemoteToken &) = default;
   explicit __fastcall TRemoteToken(const UnicodeString & Name);
 
   void __fastcall Clear();
@@ -444,6 +445,7 @@ public:
 
   __fastcall TRemoteProperties();
   __fastcall TRemoteProperties(const TRemoteProperties & rhp);
+  TRemoteProperties & operator =(const TRemoteProperties &) = default;
   bool __fastcall operator ==(const TRemoteProperties & rhp) const;
   bool __fastcall operator !=(const TRemoteProperties & rhp) const;
   void __fastcall Default();

+ 3 - 0
source/core/S3FileSystem.h

@@ -17,7 +17,10 @@ struct TS3FileProperties;
 #ifdef NEED_LIBS3
 // resolve clash
 #define S3Protocol _S3Protocol
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdocumentation"
 #include "libs3.h"
+#pragma clang diagnostic pop
 #undef S3Protocol
 #else
 struct ne_session_s;

+ 1 - 1
source/core/SecureShell.cpp

@@ -19,7 +19,7 @@ struct TPuttyTranslation
 {
   const wchar_t * Original;
   int Translation;
-  UnicodeString HelpKeyword;
+  UnicodeString HelpKeyword = UnicodeString();
 };
 //---------------------------------------------------------------------------
 struct ScpLogPolicy : public LogPolicy

+ 1 - 0
source/core/SessionInfo.h

@@ -67,6 +67,7 @@ struct TFileSystemInfo
 class TSessionUI
 {
 public:
+  virtual __fastcall ~TSessionUI() {}
   virtual void __fastcall Information(const UnicodeString & Str) = 0;
   virtual unsigned int __fastcall QueryUser(const UnicodeString Query,
     TStrings * MoreMessages, unsigned int Answers, const TQueryParams * Params,

+ 3 - 0
source/core/Terminal.cpp

@@ -17,8 +17,11 @@
 #include "Cryptography.h"
 #include "NeonIntf.h"
 #include <PuttyTools.h>
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreserved-id-macro"
 #include <openssl/pkcs12.h>
 #include <openssl/err.h>
+#pragma clang diagnostic pop
 
 #ifndef AUTO_WINSOCK
 #include <winsock2.h>

+ 3 - 0
source/filezilla/FilezillaTools.h

@@ -3,7 +3,10 @@
 #define FileZillaToolsH
 //---------------------------------------------------------------------------
 #include <ctime>
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreserved-id-macro"
 #include <openssl/ssl.h>
+#pragma clang diagnostic pop
 //---------------------------------------------------------------------------
 class CFileZillaTools
 {

+ 2 - 0
source/tb2k.cbproj

@@ -9,6 +9,7 @@
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>1</TargetedPlatforms>
         <AppType>Package</AppType>
+        <CC_Suffix Condition="'$(CC_Suffix)'==''">c</CC_Suffix>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
@@ -32,6 +33,7 @@
         <_TCHARMapping>wchar_t</_TCHARMapping>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
+        <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
         <BPILibOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</BPILibOutputDir>
         <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
         <DCC_CVT_ACHAR_TO_WCHAR>true</DCC_CVT_ACHAR_TO_WCHAR>

+ 2 - 0
source/tbxp.cbproj

@@ -9,6 +9,7 @@
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>1</TargetedPlatforms>
         <AppType>Package</AppType>
+        <CC_Suffix Condition="'$(CC_Suffix)'==''">c</CC_Suffix>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
@@ -32,6 +33,7 @@
         <_TCHARMapping>wchar_t</_TCHARMapping>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
+        <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
         <BPILibOutputDir>$(INTERM_PATH)\$(Platform)\$(Config)</BPILibOutputDir>
         <DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
         <DCC_CVT_ACHAR_TO_WCHAR>true</DCC_CVT_ACHAR_TO_WCHAR>

+ 3 - 2
source/windows/GUITools.cpp

@@ -1311,7 +1311,8 @@ public:
 protected:
   ICustomDoc * FCustomDoc;
 
-  #pragma warn -hid
+  #pragma clang diagnostic push
+  #pragma clang diagnostic ignored "-Woverloaded-virtual"
   virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID ClassId, void ** Intf)
   {
     HRESULT Result = S_OK;
@@ -1329,7 +1330,7 @@ protected:
     }
     return Result;
   }
-  #pragma warn .hid
+  #pragma clang diagnostic pop
 
   virtual ULONG STDMETHODCALLTYPE AddRef()
   {

+ 6 - 0
source/windows/GUITools.h

@@ -66,7 +66,10 @@ namespace Webbrowserex
 {
   class TWebBrowserEx;
 }
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wheader-hygiene"
 using namespace Webbrowserex;
+#pragma clang diagnostic pop
 TWebBrowserEx * __fastcall CreateBrowserViewer(TPanel * Parent, const UnicodeString & LoadingLabel);
 void __fastcall SetBrowserDesignModeOff(TWebBrowserEx * WebBrowser);
 void __fastcall AddBrowserLinkHandler(TWebBrowserEx * WebBrowser,
@@ -113,7 +116,10 @@ namespace Pngimagelist
   class TPngImageList;
   class TPngImageCollectionItem;
 }
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wheader-hygiene"
 using namespace Pngimagelist;
+#pragma clang diagnostic pop
 //---------------------------------------------------------------------------
 TPngImageList * __fastcall GetAnimationsImages(TControl * Control);
 TImageList * __fastcall GetButtonImages(TControl * Control);

+ 1 - 0
source/windows/WinConfiguration.h

@@ -257,6 +257,7 @@ struct TEditorData
 {
   __fastcall TEditorData();
   __fastcall TEditorData(const TEditorData & Source);
+  TEditorData & operator =(const TEditorData &) = default;
 
   TFileMasks FileMask;
   TEditor Editor;

+ 5 - 0
source/windows/WinInterface.cpp

@@ -1467,9 +1467,14 @@ static void __fastcall AppGetMainFormHandle(void * /*Data*/, HWND & Handle)
 //---------------------------------------------------------------------------
 void __fastcall WinInitialize()
 {
+  // Not sure if we need to call JclHookExceptions at all, stack trace tracking seems to work without it.
+  // Note though that with Clang, this does not work for exceptions explicitly raised from C++ code.
+  // Not a big deal for us, as we are primarily looking for system exceptions and internal exceptions raised from Pascal VCL code.
   if (JclHookExceptions())
   {
     JclStackTrackingOptions << stAllModules;
+    // Neeeded with Clang
+    JclStackTrackingOptions << stRawMode;
     // See also StackInfoListToStrings
     JclExceptionStacktraceOptions >> estoIncludeAdressOffset;
     CallstackThread.reset(new TCallstackThread());