diff options
author | Bernard Normier <bernard@zeroc.com> | 2016-10-31 15:54:21 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2016-10-31 15:54:21 -0400 |
commit | 107e03ea13e0eba9c33f120f0d95ac9fefc7dcad (patch) | |
tree | 00191b7ccb83fe436ad61bdbb43b523f431c6698 /cpp/src | |
parent | Update 3.7 changelog (diff) | |
download | ice-107e03ea13e0eba9c33f120f0d95ac9fefc7dcad.tar.bz2 ice-107e03ea13e0eba9c33f120f0d95ac9fefc7dcad.tar.xz ice-107e03ea13e0eba9c33f120f0d95ac9fefc7dcad.zip |
Replaced slice compiler options --ice, --underscore and --dll-export by
global metadata directives (ice-prefix, underscore, cpp:dll-export:SYMBOL and objc:dll-export:SYMBOL)
Added new cs:tie and java:tie metadata
Diffstat (limited to 'cpp/src')
55 files changed, 541 insertions, 517 deletions
diff --git a/cpp/src/Glacier2/Instrumentation.ice b/cpp/src/Glacier2/Instrumentation.ice index 3f694720422..1e90d3c17d5 100644 --- a/cpp/src/Glacier2/Instrumentation.ice +++ b/cpp/src/Glacier2/Instrumentation.ice @@ -9,7 +9,7 @@ #pragma once -[["cpp:header-ext:h"]] +[["ice-prefix", "cpp:header-ext:h"]] #include <Ice/Instrumentation.ice> diff --git a/cpp/src/Glacier2Lib/Makefile.mk b/cpp/src/Glacier2Lib/Makefile.mk index 9e6c2e72ffd..e028365efc3 100644 --- a/cpp/src/Glacier2Lib/Makefile.mk +++ b/cpp/src/Glacier2Lib/Makefile.mk @@ -12,6 +12,6 @@ $(project)_libraries := Glacier2 Glacier2_targetdir := $(libdir) Glacier2_dependencies := Ice Glacier2_cppflags := -DGLACIER2_API_EXPORTS -Glacier2_sliceflags := --include-dir Glacier2 --dll-export GLACIER2_API +Glacier2_sliceflags := --include-dir Glacier2 projects += $(project) diff --git a/cpp/src/Glacier2Lib/msbuild/glacier2++11/glacier2++11.vcxproj b/cpp/src/Glacier2Lib/msbuild/glacier2++11/glacier2++11.vcxproj index 9bf5a617918..ebe432690b0 100644 --- a/cpp/src/Glacier2Lib/msbuild/glacier2++11/glacier2++11.vcxproj +++ b/cpp/src/Glacier2Lib/msbuild/glacier2++11/glacier2++11.vcxproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> @@ -69,7 +69,6 @@ <PropertyGroup Label="IceBuilder"> <IceBuilderHeaderOutputDir>$(Ice_SrcRootDir)\include\generated\cpp11\$(Platform)\$(Configuration)\Glacier2\</IceBuilderHeaderOutputDir> <IceBuilderBaseDirectoryForGeneratedInclude>Glacier2</IceBuilderBaseDirectoryForGeneratedInclude> - <IceBuilderDLLExport>GLACIER2_API</IceBuilderDLLExport> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> @@ -399,4 +398,4 @@ <Import Project="$(IceBuilderCppTargets)" Condition="Exists('$(IceBuilderCppTargets)')" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> -</Project>
\ No newline at end of file +</Project> diff --git a/cpp/src/Glacier2Lib/msbuild/glacier2/glacier2.vcxproj b/cpp/src/Glacier2Lib/msbuild/glacier2/glacier2.vcxproj index 377ca8e94f8..13ed3ca934b 100644 --- a/cpp/src/Glacier2Lib/msbuild/glacier2/glacier2.vcxproj +++ b/cpp/src/Glacier2Lib/msbuild/glacier2/glacier2.vcxproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> @@ -73,7 +73,6 @@ <PropertyGroup Label="IceBuilder"> <IceBuilderHeaderOutputDir>$(Ice_SrcRootDir)\include\generated\cpp98\$(Platform)\$(Configuration)\Glacier2\</IceBuilderHeaderOutputDir> <IceBuilderBaseDirectoryForGeneratedInclude>Glacier2</IceBuilderBaseDirectoryForGeneratedInclude> - <IceBuilderDLLExport>GLACIER2_API</IceBuilderDLLExport> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> @@ -402,4 +401,4 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(IceBuilderCppTargets)" Condition="Exists('$(IceBuilderCppTargets)')" /> <ImportGroup Label="ExtensionTargets" /> -</Project>
\ No newline at end of file +</Project> diff --git a/cpp/src/Ice/Makefile.mk b/cpp/src/Ice/Makefile.mk index cd0ae966451..c9c751d481e 100644 --- a/cpp/src/Ice/Makefile.mk +++ b/cpp/src/Ice/Makefile.mk @@ -17,7 +17,7 @@ ifeq ($(DEFAULT_MUTEX_PROTOCOL), PrioInherit) Ice_cppflags += -DICE_PRIO_INHERIT endif -Ice_sliceflags := --include-dir Ice --dll-export ICE_API +Ice_sliceflags := --include-dir Ice Ice_libs := bz2 Ice_extra_sources := $(wildcard src/IceUtil/*.cpp) Ice_excludes = src/Ice/DLLMain.cpp diff --git a/cpp/src/Ice/msbuild/ice++11/ice++11.vcxproj b/cpp/src/Ice/msbuild/ice++11/ice++11.vcxproj index f7b60592918..93cb0e7c159 100644 --- a/cpp/src/Ice/msbuild/ice++11/ice++11.vcxproj +++ b/cpp/src/Ice/msbuild/ice++11/ice++11.vcxproj @@ -68,7 +68,6 @@ <PropertyGroup Label="IceBuilder"> <IceBuilderHeaderOutputDir>$(Ice_SrcRootDir)\include\generated\cpp11\$(Platform)\$(Configuration)\Ice\</IceBuilderHeaderOutputDir> <IceBuilderBaseDirectoryForGeneratedInclude>Ice</IceBuilderBaseDirectoryForGeneratedInclude> - <IceBuilderDLLExport>ICE_API</IceBuilderDLLExport> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> diff --git a/cpp/src/Ice/msbuild/ice/ice.vcxproj b/cpp/src/Ice/msbuild/ice/ice.vcxproj index bec21218a56..96475ccb118 100644 --- a/cpp/src/Ice/msbuild/ice/ice.vcxproj +++ b/cpp/src/Ice/msbuild/ice/ice.vcxproj @@ -73,7 +73,6 @@ <PropertyGroup Label="IceBuilder"> <IceBuilderHeaderOutputDir>$(Ice_SrcRootDir)\include\generated\cpp98\$(Platform)\$(Configuration)\Ice\</IceBuilderHeaderOutputDir> <IceBuilderBaseDirectoryForGeneratedInclude>Ice</IceBuilderBaseDirectoryForGeneratedInclude> - <IceBuilderDLLExport>ICE_API</IceBuilderDLLExport> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> diff --git a/cpp/src/IceBT/Makefile.mk b/cpp/src/IceBT/Makefile.mk index b429d77a2d0..0bd6db23a64 100644 --- a/cpp/src/IceBT/Makefile.mk +++ b/cpp/src/IceBT/Makefile.mk @@ -15,7 +15,7 @@ IceBT_targetdir := $(libdir) IceBT_dependencies := Ice IceBT_cppflags := -DICE_BT_API_EXPORTS $(shell pkg-config --cflags dbus-1) IceBT_system_libs = $(IceSSL_system_libs) $(shell pkg-config --libs dbus-1) -IceBT_sliceflags := --include-dir IceBT --dll-export ICE_BT_API +IceBT_sliceflags := --include-dir IceBT projects += $(project) diff --git a/cpp/src/IceBox/Makefile.mk b/cpp/src/IceBox/Makefile.mk index 15d0798d6bd..cf862d18496 100644 --- a/cpp/src/IceBox/Makefile.mk +++ b/cpp/src/IceBox/Makefile.mk @@ -10,7 +10,7 @@ $(project)_libraries := IceBox $(project)_programs := icebox iceboxadmin $(project)_dependencies := Ice -$(project)_sliceflags := --include-dir IceBox --dll-export ICEBOX_API +$(project)_sliceflags := --include-dir IceBox IceBox_targetdir := $(libdir) IceBox_sources := $(slicedir)/IceBox/IceBox.ice $(currentdir)/Exception.cpp diff --git a/cpp/src/IceBox/msbuild/iceboxlib++11/iceboxlib++11.vcxproj b/cpp/src/IceBox/msbuild/iceboxlib++11/iceboxlib++11.vcxproj index 6acfc2ab55e..0614befbb36 100644 --- a/cpp/src/IceBox/msbuild/iceboxlib++11/iceboxlib++11.vcxproj +++ b/cpp/src/IceBox/msbuild/iceboxlib++11/iceboxlib++11.vcxproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> @@ -81,26 +81,25 @@ <PropertyGroup Label="IceBuilder"> <IceBuilderHeaderOutputDir>$(Ice_SrcRootDir)\include\generated\cpp11\$(Platform)\$(Configuration)\IceBox\</IceBuilderHeaderOutputDir> <IceBuilderBaseDirectoryForGeneratedInclude>IceBox</IceBuilderBaseDirectoryForGeneratedInclude> - <IceBuilderDLLExport>ICE_BOX_API</IceBuilderDLLExport> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> - <PreprocessorDefinitions>ICE_BOX_API_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>ICEBOX_API_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> - <PreprocessorDefinitions>ICE_BOX_API_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>ICEBOX_API_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> - <PreprocessorDefinitions>;ICE_BOX_API_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>;ICEBOX_API_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ClCompile> - <PreprocessorDefinitions>ICE_BOX_API_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>ICEBOX_API_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> </ItemDefinitionGroup> <ItemGroup> @@ -159,4 +158,4 @@ <Import Project="$(IceBuilderCppTargets)" Condition="Exists('$(IceBuilderCppTargets)')" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> -</Project>
\ No newline at end of file +</Project> diff --git a/cpp/src/IceBox/msbuild/iceboxlib/iceboxlib.vcxproj b/cpp/src/IceBox/msbuild/iceboxlib/iceboxlib.vcxproj index f4166edcc46..d35c7e581c0 100644 --- a/cpp/src/IceBox/msbuild/iceboxlib/iceboxlib.vcxproj +++ b/cpp/src/IceBox/msbuild/iceboxlib/iceboxlib.vcxproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> @@ -81,26 +81,25 @@ <PropertyGroup Label="IceBuilder"> <IceBuilderHeaderOutputDir>$(Ice_SrcRootDir)\include\generated\cpp98\$(Platform)\$(Configuration)\IceBox\</IceBuilderHeaderOutputDir> <IceBuilderBaseDirectoryForGeneratedInclude>IceBox</IceBuilderBaseDirectoryForGeneratedInclude> - <IceBuilderDLLExport>ICE_BOX_API</IceBuilderDLLExport> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> - <PreprocessorDefinitions>ICE_BOX_API_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>ICEBOX_API_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> - <PreprocessorDefinitions>ICE_BOX_API_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>ICEBOX_API_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> - <PreprocessorDefinitions>ICE_BOX_API_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>ICEBOX_API_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ClCompile> - <PreprocessorDefinitions>ICE_BOX_API_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>ICEBOX_API_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> </ItemDefinitionGroup> <ItemGroup> @@ -159,4 +158,4 @@ <Import Project="$(IceBuilderCppTargets)" Condition="Exists('$(IceBuilderCppTargets)')" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> -</Project>
\ No newline at end of file +</Project> diff --git a/cpp/src/IceGrid/Internal.ice b/cpp/src/IceGrid/Internal.ice index 0208d8903f0..21282309477 100644 --- a/cpp/src/IceGrid/Internal.ice +++ b/cpp/src/IceGrid/Internal.ice @@ -9,7 +9,7 @@ #pragma once -[["cpp:header-ext:h"]] +[["ice-prefix", "cpp:header-ext:h"]] #include <Ice/Identity.ice> #include <Ice/BuiltinSequences.ice> diff --git a/cpp/src/IceGridLib/Makefile.mk b/cpp/src/IceGridLib/Makefile.mk index 577f900fbd9..cc78f18bf7d 100644 --- a/cpp/src/IceGridLib/Makefile.mk +++ b/cpp/src/IceGridLib/Makefile.mk @@ -11,6 +11,6 @@ $(project)_libraries := IceGrid IceGrid_targetdir := $(libdir) IceGrid_dependencies := Glacier2 Ice -IceGrid_sliceflags := --include-dir IceGrid --dll-export ICE_GRID_API +IceGrid_sliceflags := --include-dir IceGrid projects += $(project) diff --git a/cpp/src/IceGridLib/msbuild/icegrid++11/icegrid++11.vcxproj b/cpp/src/IceGridLib/msbuild/icegrid++11/icegrid++11.vcxproj index 9cad1eb92e6..2851e80aa03 100644 --- a/cpp/src/IceGridLib/msbuild/icegrid++11/icegrid++11.vcxproj +++ b/cpp/src/IceGridLib/msbuild/icegrid++11/icegrid++11.vcxproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> @@ -69,7 +69,6 @@ <PropertyGroup Label="IceBuilder"> <IceBuilderHeaderOutputDir>$(Ice_SrcRootDir)\include\generated\cpp11\$(Platform)\$(Configuration)\IceGrid\</IceBuilderHeaderOutputDir> <IceBuilderBaseDirectoryForGeneratedInclude>IceGrid</IceBuilderBaseDirectoryForGeneratedInclude> - <IceBuilderDLLExport>ICE_GRID_API</IceBuilderDLLExport> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> @@ -440,4 +439,4 @@ <Import Project="$(IceBuilderCppTargets)" Condition="Exists('$(IceBuilderCppTargets)')" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> -</Project>
\ No newline at end of file +</Project> diff --git a/cpp/src/IceGridLib/msbuild/icegrid/icegrid.vcxproj b/cpp/src/IceGridLib/msbuild/icegrid/icegrid.vcxproj index 886ed61a4b0..b75e5ed32ef 100644 --- a/cpp/src/IceGridLib/msbuild/icegrid/icegrid.vcxproj +++ b/cpp/src/IceGridLib/msbuild/icegrid/icegrid.vcxproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> @@ -73,7 +73,6 @@ <PropertyGroup Label="IceBuilder"> <IceBuilderHeaderOutputDir>$(Ice_SrcRootDir)\include\generated\cpp98\$(Platform)\$(Configuration)\IceGrid\</IceBuilderHeaderOutputDir> <IceBuilderBaseDirectoryForGeneratedInclude>IceGrid</IceBuilderBaseDirectoryForGeneratedInclude> - <IceBuilderDLLExport>ICE_GRID_API</IceBuilderDLLExport> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> @@ -444,4 +443,4 @@ <Import Project="$(IceBuilderCppTargets)" Condition="Exists('$(IceBuilderCppTargets)')" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> -</Project>
\ No newline at end of file +</Project> diff --git a/cpp/src/IceIAP/Makefile.mk b/cpp/src/IceIAP/Makefile.mk index daeffbead19..ebf3b7c3f23 100644 --- a/cpp/src/IceIAP/Makefile.mk +++ b/cpp/src/IceIAP/Makefile.mk @@ -14,7 +14,7 @@ IceIAP_platforms := iphoneos iphonesimulator IceIAP_targetdir := $(libdir) IceIAP_dependencies := Ice -IceIAP_sliceflags := --include-dir IceIAP --dll-export ICE_IAP_API +IceIAP_sliceflags := --include-dir IceIAP IceIAP_cppflags := -DICE_IAP_API_EXPORTS projects += $(project) diff --git a/cpp/src/IcePatch2Lib/Makefile.mk b/cpp/src/IcePatch2Lib/Makefile.mk index ca8f7ab85ff..28ae8689c5c 100644 --- a/cpp/src/IcePatch2Lib/Makefile.mk +++ b/cpp/src/IcePatch2Lib/Makefile.mk @@ -12,7 +12,7 @@ $(project)_libraries := IcePatch2 IcePatch2_targetdir := $(libdir) IcePatch2_dependencies := Ice IcePatch2_libs := bz2 -IcePatch2_sliceflags := --include-dir IcePatch2 --dll-export ICE_PATCH2_API +IcePatch2_sliceflags := --include-dir IcePatch2 IcePatch2_cppflags := $(nodeprecatedwarnings-cppflags) projects += $(project) diff --git a/cpp/src/IcePatch2Lib/msbuild/icepatch2.vcxproj b/cpp/src/IcePatch2Lib/msbuild/icepatch2.vcxproj index 1fc3000d0b3..59616ccc418 100644 --- a/cpp/src/IcePatch2Lib/msbuild/icepatch2.vcxproj +++ b/cpp/src/IcePatch2Lib/msbuild/icepatch2.vcxproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> @@ -68,7 +68,6 @@ <PropertyGroup Label="IceBuilder"> <IceBuilderHeaderOutputDir>$(Ice_SrcRootDir)\include\generated\cpp98\$(Platform)\$(Configuration)\IcePatch2\</IceBuilderHeaderOutputDir> <IceBuilderBaseDirectoryForGeneratedInclude>IcePatch2</IceBuilderBaseDirectoryForGeneratedInclude> - <IceBuilderDLLExport>ICE_PATCH2_API</IceBuilderDLLExport> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> @@ -207,4 +206,4 @@ <Error Condition="!Exists('..\..\..\msbuild\packages\bzip2.v140.1.0.6.4\build\native\bzip2.v140.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\msbuild\packages\bzip2.v140.1.0.6.4\build\native\bzip2.v140.targets'))" /> <Error Condition="!Exists('..\..\..\msbuild\packages\bzip2.v120.1.0.6.4\build\native\bzip2.v120.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\msbuild\packages\bzip2.v120.1.0.6.4\build\native\bzip2.v120.targets'))" /> </Target> -</Project>
\ No newline at end of file +</Project> diff --git a/cpp/src/IceSSL/Makefile.mk b/cpp/src/IceSSL/Makefile.mk index 0e2e3d00e94..75a4535439a 100644 --- a/cpp/src/IceSSL/Makefile.mk +++ b/cpp/src/IceSSL/Makefile.mk @@ -12,6 +12,6 @@ $(project)_libraries := IceSSL IceSSL_targetdir := $(libdir) IceSSL_dependencies := Ice IceSSL_cppflags := -DICE_SSL_API_EXPORTS -IceSSL_sliceflags := --include-dir IceSSL --dll-export ICE_SSL_API +IceSSL_sliceflags := --include-dir IceSSL projects += $(project) diff --git a/cpp/src/IceSSL/msbuild/icessl++11/icessl++11.vcxproj b/cpp/src/IceSSL/msbuild/icessl++11/icessl++11.vcxproj index 046de28a09a..78f8038fd5a 100644 --- a/cpp/src/IceSSL/msbuild/icessl++11/icessl++11.vcxproj +++ b/cpp/src/IceSSL/msbuild/icessl++11/icessl++11.vcxproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> @@ -68,7 +68,6 @@ <PropertyGroup Label="IceBuilder"> <IceBuilderHeaderOutputDir>$(Ice_SrcRootDir)\include\generated\cpp11\$(Platform)\$(Configuration)\IceSSL\</IceBuilderHeaderOutputDir> <IceBuilderBaseDirectoryForGeneratedInclude>IceSSL</IceBuilderBaseDirectoryForGeneratedInclude> - <IceBuilderDLLExport>ICE_SSL_API</IceBuilderDLLExport> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> @@ -225,4 +224,4 @@ <Import Project="$(IceBuilderCppTargets)" Condition="Exists('$(IceBuilderCppTargets)')" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> -</Project>
\ No newline at end of file +</Project> diff --git a/cpp/src/IceSSL/msbuild/icessl/icessl.vcxproj b/cpp/src/IceSSL/msbuild/icessl/icessl.vcxproj index 4826c43666e..fb6ffc509d0 100644 --- a/cpp/src/IceSSL/msbuild/icessl/icessl.vcxproj +++ b/cpp/src/IceSSL/msbuild/icessl/icessl.vcxproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> @@ -73,7 +73,6 @@ <PropertyGroup Label="IceBuilder"> <IceBuilderHeaderOutputDir>$(Ice_SrcRootDir)\include\generated\cpp98\$(Platform)\$(Configuration)\IceSSL\</IceBuilderHeaderOutputDir> <IceBuilderBaseDirectoryForGeneratedInclude>IceSSL</IceBuilderBaseDirectoryForGeneratedInclude> - <IceBuilderDLLExport>ICE_SSL_API</IceBuilderDLLExport> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> @@ -230,4 +229,4 @@ <Import Project="$(IceBuilderCppTargets)" Condition="Exists('$(IceBuilderCppTargets)')" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> -</Project>
\ No newline at end of file +</Project> diff --git a/cpp/src/IceStorm/DBTypes.ice b/cpp/src/IceStorm/DBTypes.ice index 79a9154c07f..582155d8b2f 100644 --- a/cpp/src/IceStorm/DBTypes.ice +++ b/cpp/src/IceStorm/DBTypes.ice @@ -9,7 +9,7 @@ #pragma once -[["cpp:header-ext:h"]] +[["ice-prefix", "cpp:header-ext:h"]] #include <IceStorm/SubscriberRecord.ice> #include <IceStorm/LLURecord.ice> diff --git a/cpp/src/IceStorm/Election.ice b/cpp/src/IceStorm/Election.ice index 0c2fc25c51f..96343e4559d 100644 --- a/cpp/src/IceStorm/Election.ice +++ b/cpp/src/IceStorm/Election.ice @@ -9,7 +9,7 @@ #pragma once -[["cpp:header-ext:h"]] +[["ice-prefix", "cpp:header-ext:h"]] #include <Ice/Identity.ice> #include <Ice/BuiltinSequences.ice> diff --git a/cpp/src/IceStorm/IceStormInternal.ice b/cpp/src/IceStorm/IceStormInternal.ice index bafb51717fa..009e4a29876 100644 --- a/cpp/src/IceStorm/IceStormInternal.ice +++ b/cpp/src/IceStorm/IceStormInternal.ice @@ -9,7 +9,7 @@ #pragma once -[["cpp:header-ext:h"]] +[["ice-prefix", "cpp:header-ext:h"]] #include <IceStorm/IceStorm.ice> #include <IceStorm/Election.ice> diff --git a/cpp/src/IceStorm/Instrumentation.ice b/cpp/src/IceStorm/Instrumentation.ice index 9ee8a8cba5c..2c488805b54 100644 --- a/cpp/src/IceStorm/Instrumentation.ice +++ b/cpp/src/IceStorm/Instrumentation.ice @@ -9,7 +9,7 @@ #pragma once -[["cpp:header-ext:h"]] +[["ice-prefix", "cpp:header-ext:h"]] #include <Ice/Instrumentation.ice> #include <IceStorm/IceStorm.ice> diff --git a/cpp/src/IceStorm/LLURecord.ice b/cpp/src/IceStorm/LLURecord.ice index 0bcb6032f43..2ec7a4eaf46 100644 --- a/cpp/src/IceStorm/LLURecord.ice +++ b/cpp/src/IceStorm/LLURecord.ice @@ -9,7 +9,7 @@ #pragma once -[["cpp:header-ext:h"]] +[["ice-prefix", "cpp:header-ext:h"]] module IceStormElection { diff --git a/cpp/src/IceStorm/LinkRecord.ice b/cpp/src/IceStorm/LinkRecord.ice index bff551353b7..f4a9a3ad615 100644 --- a/cpp/src/IceStorm/LinkRecord.ice +++ b/cpp/src/IceStorm/LinkRecord.ice @@ -9,7 +9,7 @@ #pragma once -[["cpp:header-ext:h"]] +[["ice-prefix", "cpp:header-ext:h"]] #include <Ice/Identity.ice> #include <IceStorm/IceStormInternal.ice> diff --git a/cpp/src/IceStorm/SubscriberRecord.ice b/cpp/src/IceStorm/SubscriberRecord.ice index e528d27c0ec..cfd1bc103a2 100644 --- a/cpp/src/IceStorm/SubscriberRecord.ice +++ b/cpp/src/IceStorm/SubscriberRecord.ice @@ -9,7 +9,7 @@ #pragma once -[["cpp:header-ext:h"]] +[["ice-prefix", "cpp:header-ext:h"]] #include <Ice/Identity.ice> #include <IceStorm/IceStorm.ice> diff --git a/cpp/src/IceStormLib/Makefile.mk b/cpp/src/IceStormLib/Makefile.mk index b00e2e3a72a..cad251df280 100644 --- a/cpp/src/IceStormLib/Makefile.mk +++ b/cpp/src/IceStormLib/Makefile.mk @@ -11,6 +11,6 @@ $(project)_libraries := IceStorm IceStorm_targetdir := $(libdir) IceStorm_dependencies := Ice -IceStorm_sliceflags := --include-dir IceStorm --dll-export ICE_STORM_LIB_API +IceStorm_sliceflags := --include-dir IceStorm projects += $(project) diff --git a/cpp/src/IceStormLib/msbuild/icestorm++11/icestorm++11.vcxproj b/cpp/src/IceStormLib/msbuild/icestorm++11/icestorm++11.vcxproj index cd8879e9d2b..af3aabd6daa 100644 --- a/cpp/src/IceStormLib/msbuild/icestorm++11/icestorm++11.vcxproj +++ b/cpp/src/IceStormLib/msbuild/icestorm++11/icestorm++11.vcxproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> @@ -68,7 +68,6 @@ <PropertyGroup Label="IceBuilder"> <IceBuilderHeaderOutputDir>$(Ice_SrcRootDir)\include\generated\cpp11\$(Platform)\$(Configuration)\IceStorm\</IceBuilderHeaderOutputDir> <IceBuilderBaseDirectoryForGeneratedInclude>IceStorm</IceBuilderBaseDirectoryForGeneratedInclude> - <IceBuilderDLLExport>ICE_STORM_LIB_API</IceBuilderDLLExport> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> @@ -185,4 +184,4 @@ <Import Project="$(IceBuilderCppTargets)" Condition="Exists('$(IceBuilderCppTargets)')" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> -</Project>
\ No newline at end of file +</Project> diff --git a/cpp/src/IceStormLib/msbuild/icestorm/icestorm.vcxproj b/cpp/src/IceStormLib/msbuild/icestorm/icestorm.vcxproj index c1013ec34d5..268b1663156 100644 --- a/cpp/src/IceStormLib/msbuild/icestorm/icestorm.vcxproj +++ b/cpp/src/IceStormLib/msbuild/icestorm/icestorm.vcxproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> @@ -68,7 +68,6 @@ <PropertyGroup Label="IceBuilder"> <IceBuilderHeaderOutputDir>$(Ice_SrcRootDir)\include\generated\cpp98\$(Platform)\$(Configuration)\IceStorm\</IceBuilderHeaderOutputDir> <IceBuilderBaseDirectoryForGeneratedInclude>IceStorm</IceBuilderBaseDirectoryForGeneratedInclude> - <IceBuilderDLLExport>ICE_STORM_LIB_API</IceBuilderDLLExport> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> @@ -185,4 +184,4 @@ <Import Project="$(IceBuilderCppTargets)" Condition="Exists('$(IceBuilderCppTargets)')" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> -</Project>
\ No newline at end of file +</Project> diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp index ad8d3628d65..0a20815d592 100644 --- a/cpp/src/Slice/JavaUtil.cpp +++ b/cpp/src/Slice/JavaUtil.cpp @@ -164,10 +164,15 @@ public: bool ok = false; static const string packagePrefix = "java:package:"; + static const string checksumPrefix = "java:checksum:"; if(s.find(packagePrefix) == 0 && s.size() > packagePrefix.size()) { ok = true; } + else if(s.find(checksumPrefix) == 0 && s.size() > checksumPrefix.size()) + { + ok = true; + } if(!ok) { @@ -369,12 +374,18 @@ private: if(rest == "getset") { result.push_back(s); + continue; } else if(rest == "buffer") { result.push_back(s); + continue; + } + else if(rest == "tie") + { + result.push_back(s); + continue; } - continue; } } else if(s.substr(prefix.size(), pos - prefix.size()) == "type") diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index e1a88c3f559..e6e8fb768a6 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -2426,23 +2426,34 @@ Slice::Container::checkIdentifier(const string& name) const // // For rules controlled by a translator option, we don't complain about included files. // - _unit->error("illegal underscore in identifier `" + name + "'"); + + DefinitionContextPtr dc = _unit->currentDefinitionContext(); + assert(dc); + if(dc->findMetaData("underscore") != "underscore") // no "underscore" global metadata + { + _unit->error("illegal underscore in identifier `" + name + "'"); + } } + // + // For rules controlled by a translator option, we don't complain about included files. + // if(_unit->currentIncludeLevel() == 0 && !_unit->allowIcePrefix()) { - // - // For rules controlled by a translator option, we don't complain about included files. - // - if(name.size() >= 3) + DefinitionContextPtr dc = _unit->currentDefinitionContext(); + assert(dc); + if(dc->findMetaData("ice-prefix") != "ice-prefix") // no "ice-prefix" global metadata { - string prefix3; - prefix3 += ::tolower(static_cast<unsigned char>(name[0])); - prefix3 += ::tolower(static_cast<unsigned char>(name[1])); - prefix3 += ::tolower(static_cast<unsigned char>(name[2])); - if(prefix3 == "ice") + if(name.size() >= 3) { - _unit->error("illegal identifier `" + name + "': `" + name.substr(0, 3) + "' prefix is reserved"); + string prefix3; + prefix3 += ::tolower(static_cast<unsigned char>(name[0])); + prefix3 += ::tolower(static_cast<unsigned char>(name[1])); + prefix3 += ::tolower(static_cast<unsigned char>(name[2])); + if(prefix3 == "ice") + { + _unit->error("illegal identifier `" + name + "': `" + name.substr(0, 3) + "' prefix is reserved"); + } } } } diff --git a/cpp/src/Slice/Python.cpp b/cpp/src/Slice/Python.cpp index 73a470260c4..cf46117d345 100644 --- a/cpp/src/Slice/Python.cpp +++ b/cpp/src/Slice/Python.cpp @@ -398,11 +398,13 @@ usage(const string& n) "--depend-xml Generate dependencies in XML format.\n" "--depend-file FILE Write dependencies to FILE instead of standard output.\n" "-d, --debug Print debug messages.\n" - "--ice Permit `Ice' prefix (for building Ice source code only).\n" - "--underscore Permit underscores in Slice identifiers.\n" "--all Generate code for Slice definitions in included files.\n" "--checksum Generate checksums for Slice definitions.\n" "--prefix PREFIX Prepend filenames of Python modules with PREFIX.\n" + "--ice Allow reserved Ice prefix in Slice identifiers\n" + " deprecated: use instead [[\"ice-prefix\"]] metadata.\n" + "--underscore Allow underscores in Slice identifiers\n" + " deprecated: use instead [[\"underscore\"]] metadata.\n" ; } diff --git a/cpp/src/Slice/Ruby.cpp b/cpp/src/Slice/Ruby.cpp index 799e72c264b..fe0a05ad0e2 100644 --- a/cpp/src/Slice/Ruby.cpp +++ b/cpp/src/Slice/Ruby.cpp @@ -73,10 +73,12 @@ usage(const string& n) "--depend-xml Generate dependencies in XML format.\n" "--depend-file FILE Write dependencies to FILE instead of standard output.\n" "-d, --debug Print debug messages.\n" - "--ice Permit `Ice' prefix (for building Ice source code only).\n" - "--underscore Permit underscores in Slice identifiers.\n" "--all Generate code for Slice definitions in included files.\n" "--checksum Generate checksums for Slice definitions.\n" + "--ice Allow reserved Ice prefix in Slice identifiers\n" + " deprecated: use instead [[\"ice-prefix\"]] metadata.\n" + "--underscore Allow underscores in Slice identifiers\n" + " deprecated: use instead [[\"underscore\"]] metadata.\n" ; } diff --git a/cpp/src/icegriddb/DBTypes.ice b/cpp/src/icegriddb/DBTypes.ice index 6729a6bf434..daa4f59bda8 100644 --- a/cpp/src/icegriddb/DBTypes.ice +++ b/cpp/src/icegriddb/DBTypes.ice @@ -11,7 +11,7 @@ #include <IceGrid/Admin.ice> -[["cpp:header-ext:h"]] +[["ice-prefix", "cpp:header-ext:h"]] module IceGrid { diff --git a/cpp/src/icegriddb/Makefile.mk b/cpp/src/icegriddb/Makefile.mk index 7150b79492d..69e68ea9bbb 100644 --- a/cpp/src/icegriddb/Makefile.mk +++ b/cpp/src/icegriddb/Makefile.mk @@ -9,7 +9,7 @@ $(project)_programs := icegriddb $(project)_generated_includedir := $(project)/generated/IceGrid -$(project)_sliceflags := -Isrc --include-dir IceGrid +$(project)_sliceflags := -Isrc --include-dir IceGrid -DICE_BUILDING_ICEGRIDDB $(project)/IceGridDB.cpp: $(includedir)/generated/IceGrid/Admin.h $(project)/generated/DBTypes.cpp: $(includedir)/generated/IceGrid/Admin.h diff --git a/cpp/src/icegriddb/msbuild/icegriddb.vcxproj b/cpp/src/icegriddb/msbuild/icegriddb.vcxproj index 2ab0f884902..5670030372f 100644 --- a/cpp/src/icegriddb/msbuild/icegriddb.vcxproj +++ b/cpp/src/icegriddb/msbuild/icegriddb.vcxproj @@ -97,8 +97,7 @@ <IceBuilderIncludeDirectories>$(Ice_SrcRootDir)\src\;$(IceBuilderIncludeDirectories)</IceBuilderIncludeDirectories> <IceBuilderHeaderOutputDir>$(Platform)\$(Configuration)\IceGrid\</IceBuilderHeaderOutputDir> <IceBuilderBaseDirectoryForGeneratedInclude>IceGrid</IceBuilderBaseDirectoryForGeneratedInclude> - <IceBuilderAdditionalOptions> - </IceBuilderAdditionalOptions> + <IceBuilderAdditionalOptions>-DICE_BUILDING_ICEGRIDDB</IceBuilderAdditionalOptions> </PropertyGroup> <ItemGroup> <ResourceCompile Include="..\IceGridDB.rc" /> diff --git a/cpp/src/icegriddb/msbuild/icegriddb.vcxproj.filters b/cpp/src/icegriddb/msbuild/icegriddb.vcxproj.filters index 20bf3556d94..82743311913 100644 --- a/cpp/src/icegriddb/msbuild/icegriddb.vcxproj.filters +++ b/cpp/src/icegriddb/msbuild/icegriddb.vcxproj.filters @@ -55,7 +55,7 @@ </Filter> </ItemGroup> <ItemGroup> - <ResourceCompile Include="..\..\IceGridDB.rc"> + <ResourceCompile Include="..\IceGridDB.rc"> <Filter>Resource Files</Filter> </ResourceCompile> </ItemGroup> @@ -71,9 +71,6 @@ </IceBuilder> </ItemGroup> <ItemGroup> - <ClCompile Include="..\..\IceGridDB.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="Win32\Debug\Descriptor.cpp"> <Filter>Source Files\Win32\Debug</Filter> </ClCompile> @@ -110,6 +107,9 @@ <ClCompile Include="x64\Release\DBTypes.cpp"> <Filter>Source Files\x64\Release</Filter> </ClCompile> + <ClCompile Include="..\IceGridDB.cpp"> + <Filter>Source Files</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="Win32\Debug\IceGrid\Descriptor.h"> diff --git a/cpp/src/slice2confluence/Main.cpp b/cpp/src/slice2confluence/Main.cpp index 8bf3cd85ba5..ad6b22c9307 100644 --- a/cpp/src/slice2confluence/Main.cpp +++ b/cpp/src/slice2confluence/Main.cpp @@ -103,8 +103,10 @@ usage(const string& n) "--index NUM Generate subindex if it has at least NUM entries (0 for no index, default=1).\n" "--summary NUM Print a warning if a summary sentence exceeds NUM characters.\n" "-d, --debug Print debug messages.\n" - "--ice Allow reserved Ice prefix in Slice identifiers.\n" - "--underscore Allow underscores in Slice identifiers.\n" + "--ice Allow reserved Ice prefix in Slice identifiers\n" + " deprecated: use instead [[\"ice-prefix\"]] metadata.\n" + "--underscore Allow underscores in Slice identifiers\n" + " deprecated: use instead [[\"underscore\"]] metadata.\n" ; } diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 978ab8114f2..ad125388647 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -463,6 +463,21 @@ Slice::Gen::generate(const UnitPtr& p) _headerExtension = headerExtension; } + // + // Give precedence to --dll-export command-line option + // + if(_dllExport.empty()) + { + DefinitionContextPtr dc = p->findDefinitionContext(file); + assert(dc); + static const string dllExportPrefix = "cpp:dll-export:"; + string meta = dc->findMetaData(dllExportPrefix); + if(meta.size() > dllExportPrefix.size()) + { + _dllExport = meta.substr(dllExportPrefix.size()); + } + } + if(_implCpp98 || _implCpp11) { string fileImplH = _base + "I." + _implHeaderExtension; @@ -4459,6 +4474,7 @@ Slice::Gen::MetaDataVisitor::visitUnitStart(const UnitPtr& p) assert(dc); StringList globalMetaData = dc->getMetaData(); int headerExtension = 0; + int dllExport = 0; for(StringList::const_iterator r = globalMetaData.begin(); r != globalMetaData.end(); ++r) { string s = *r; @@ -4468,6 +4484,8 @@ Slice::Gen::MetaDataVisitor::visitUnitStart(const UnitPtr& p) { static const string cppIncludePrefix = "cpp:include:"; static const string cppHeaderExtPrefix = "cpp:header-ext:"; + static const string cppDllExportPrefix = "cpp:dll-export:"; + if(s.find(cppIncludePrefix) == 0 && s.size() > cppIncludePrefix.size()) { continue; @@ -4485,6 +4503,20 @@ Slice::Gen::MetaDataVisitor::visitUnitStart(const UnitPtr& p) } continue; } + else if(s.find(cppDllExportPrefix) == 0 && s.size() > cppDllExportPrefix.size()) + { + dllExport++; + if(dllExport > 1) + { + ostringstream ostr; + ostr << "ignoring invalid global metadata `" << s + << "': directive can appear only once per file"; + emitWarning(file, -1, ostr.str()); + _history.insert(s); + } + continue; + } + ostringstream ostr; ostr << "ignoring invalid global metadata `" << s << "'"; emitWarning(file, -1, ostr.str()); diff --git a/cpp/src/slice2cpp/Main.cpp b/cpp/src/slice2cpp/Main.cpp index 27376433b57..72a549b454e 100644 --- a/cpp/src/slice2cpp/Main.cpp +++ b/cpp/src/slice2cpp/Main.cpp @@ -72,16 +72,19 @@ usage(const string& n) "-E Print preprocessor output on stdout.\n" "--include-dir DIR Use DIR as the header include directory in source files.\n" "--output-dir DIR Create files in the directory DIR.\n" - "--dll-export SYMBOL Use SYMBOL for DLL exports.\n" "--impl-c++98 Generate sample implementations for C++98 mapping.\n" "--impl-c++11 Generate sample implementations for C++11 mapping.\n" + "--checksum Generate checksums for Slice definitions.\n" "--depend Generate Makefile dependencies.\n" "--depend-xml Generate dependencies in XML format.\n" "--depend-file FILE Write dependencies to FILE instead of standard output.\n" "-d, --debug Print debug messages.\n" - "--ice Allow reserved Ice prefix in Slice identifiers.\n" - "--underscore Allow underscores in Slice identifiers.\n" - "--checksum Generate checksums for Slice definitions.\n" + "--dll-export SYMBOL Use SYMBOL for DLL exports\n" + " deprecated: use instead [[\"cpp:dll-export:SYMBOL\"]] metadata.\n" + "--ice Allow reserved Ice prefix in Slice identifiers\n" + " deprecated: use instead [[\"ice-prefix\"]] metadata.\n" + "--underscore Allow underscores in Slice identifiers\n" + " deprecated: use instead [[\"underscore\"]] metadata.\n" ; } @@ -174,7 +177,7 @@ compile(const vector<string>& argv) string dllExport = opts.optArg("dll-export"); bool implCpp98 = opts.isSet("impl-c++98"); - + bool implCpp11 = opts.isSet("impl-c++11"); bool depend = opts.isSet("depend"); @@ -210,7 +213,7 @@ compile(const vector<string>& argv) } return EXIT_FAILURE; } - + if(implCpp98 && implCpp11) { getErrorStream() << argv[0] << ": error: cannot specify both --impl-c++98 and --impl-c++11" << endl; diff --git a/cpp/src/slice2cs/CsUtil.cpp b/cpp/src/slice2cs/CsUtil.cpp index 83aabc950d5..3487cde3fce 100644 --- a/cpp/src/slice2cs/CsUtil.cpp +++ b/cpp/src/slice2cs/CsUtil.cpp @@ -2531,10 +2531,15 @@ Slice::CsGenerator::MetaDataVisitor::validate(const ContainedPtr& cont) if(s.find(prefix) == 0) { static const string csAttributePrefix = prefix + "attribute:"; + static const string csTie = prefix + "tie"; if(s.find(csAttributePrefix) == 0 && s.size() > csAttributePrefix.size()) { continue; } + else if(s.find(csTie) == 0 && s.size() == csTie.size()) + { + continue; + } emitWarning(cont->file(), cont->line(), msg + " `" + s + "'"); _history.insert(s); } diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 1fe547582ab..9122c83a68b 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -1984,7 +1984,9 @@ Slice::CsVisitor::writeDocCommentParam(const OperationPtr& p, ParamDir paramType } Slice::Gen::Gen(const string& base, const vector<string>& includePaths, const string& dir, - bool impl, bool implTie) : _includePaths(includePaths) + bool tie, bool impl, bool implTie) : + _includePaths(includePaths), + _tie(tie) { string fileBase = base; string::size_type pos = base.find_last_of("/\\"); @@ -2084,18 +2086,11 @@ Slice::Gen::generate(const UnitPtr& p) HelperVisitor helperVisitor(_out); p->visit(&helperVisitor, false); - DispatcherVisitor dispatcherVisitor(_out); + DispatcherVisitor dispatcherVisitor(_out, _tie); p->visit(&dispatcherVisitor, false); } void -Slice::Gen::generateTie(const UnitPtr& p) -{ - TieVisitor tieVisitor(_out); - p->visit(&tieVisitor, false); -} - -void Slice::Gen::generateImpl(const UnitPtr& p) { ImplVisitor implVisitor(_impl); @@ -5149,8 +5144,9 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p) _out << eb; } -Slice::Gen::DispatcherVisitor::DispatcherVisitor(::IceUtilInternal::Output &out) - : CsVisitor(out) +Slice::Gen::DispatcherVisitor::DispatcherVisitor(::IceUtilInternal::Output& out, bool tie) : + CsVisitor(out), + _tie(tie) { } @@ -5241,113 +5237,80 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p) } writeInheritedOperations(p); - writeDispatch(p); - _out << eb; - - return true; -} - -Slice::Gen::TieVisitor::TieVisitor(IceUtilInternal::Output& out) - : CsVisitor(out) -{ -} - -bool -Slice::Gen::TieVisitor::visitModuleStart(const ModulePtr& p) -{ - if(!p->hasClassDefs()) + if((_tie || p->hasMetaData("cs:tie")) && !p->isLocal() && p->isAbstract()) { - return false; - } - - _out << sp << nl << "namespace " << fixId(p->name()); - _out << sb; + // Need to generate tie - return true; -} - -void -Slice::Gen::TieVisitor::visitModuleEnd(const ModulePtr&) -{ - _out << eb; -} - -bool -Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p) -{ - if(p->isLocal() || !p->isAbstract()) - { - return false; - } + // close previous class + _out << eb; - string name = p->name(); - string opIntfName = "Operations"; + string opIntfName = "Operations"; - _out << sp; - emitComVisibleAttribute(); - emitGeneratedCodeAttribute(); - _out << nl << "public class " << name << "Tie_ : " << name << "Disp_, Ice.TieBase"; + _out << sp; + emitComVisibleAttribute(); + emitGeneratedCodeAttribute(); + _out << nl << "public class " << name << "Tie_ : " << name << "Disp_, Ice.TieBase"; - _out << sb; + _out << sb; - _out << sp << nl << "public " << name << "Tie_()"; - _out << sb; - _out << eb; + _out << sp << nl << "public " << name << "Tie_()"; + _out << sb; + _out << eb; - _out << sp << nl << "public " << name << "Tie_(" << name << opIntfName << "_ del)"; - _out << sb; - _out << nl << "_ice_delegate = del;"; - _out << eb; + _out << sp << nl << "public " << name << "Tie_(" << name << opIntfName << "_ del)"; + _out << sb; + _out << nl << "_ice_delegate = del;"; + _out << eb; - _out << sp << nl << "public object ice_delegate()"; - _out << sb; - _out << nl << "return _ice_delegate;"; - _out << eb; + _out << sp << nl << "public object ice_delegate()"; + _out << sb; + _out << nl << "return _ice_delegate;"; + _out << eb; - _out << sp << nl << "public void ice_delegate(object del)"; - _out << sb; - _out << nl << "_ice_delegate = (" << name << opIntfName << "_)del;"; - _out << eb; + _out << sp << nl << "public void ice_delegate(object del)"; + _out << sb; + _out << nl << "_ice_delegate = (" << name << opIntfName << "_)del;"; + _out << eb; - _out << sp << nl << "public override int GetHashCode()"; - _out << sb; - _out << nl << "return _ice_delegate == null ? 0 : _ice_delegate.GetHashCode();"; - _out << eb; + _out << sp << nl << "public override int GetHashCode()"; + _out << sb; + _out << nl << "return _ice_delegate == null ? 0 : _ice_delegate.GetHashCode();"; + _out << eb; - _out << sp << nl << "public override bool Equals(object rhs)"; - _out << sb; - _out << nl << "if(object.ReferenceEquals(this, rhs))"; - _out << sb; - _out << nl << "return true;"; - _out << eb; - _out << nl << "if(!(rhs is " << name << "Tie_))"; - _out << sb; - _out << nl << "return false;"; - _out << eb; - _out << nl << "if(_ice_delegate == null)"; - _out << sb; - _out << nl << "return ((" << name << "Tie_)rhs)._ice_delegate == null;"; - _out << eb; - _out << nl << "return _ice_delegate.Equals(((" << name << "Tie_)rhs)._ice_delegate);"; - _out << eb; + _out << sp << nl << "public override bool Equals(object rhs)"; + _out << sb; + _out << nl << "if(object.ReferenceEquals(this, rhs))"; + _out << sb; + _out << nl << "return true;"; + _out << eb; + _out << nl << "if(!(rhs is " << name << "Tie_))"; + _out << sb; + _out << nl << "return false;"; + _out << eb; + _out << nl << "if(_ice_delegate == null)"; + _out << sb; + _out << nl << "return ((" << name << "Tie_)rhs)._ice_delegate == null;"; + _out << eb; + _out << nl << "return _ice_delegate.Equals(((" << name << "Tie_)rhs)._ice_delegate);"; + _out << eb; - writeOperations(p); + writeTieOperations(p); - _out << sp << nl << "private " << name << opIntfName << "_ _ice_delegate;"; + _out << sp << nl << "private " << name << opIntfName << "_ _ice_delegate;"; + } return true; } - void -Slice::Gen::TieVisitor::visitClassDefEnd(const ClassDefPtr&) +Slice::Gen::DispatcherVisitor::visitClassDefEnd(const ClassDefPtr&) { _out << eb; } void -Slice::Gen::TieVisitor::writeOperations(const ClassDefPtr& p, NameSet* opNames) +Slice::Gen::DispatcherVisitor::writeTieOperations(const ClassDefPtr& p, NameSet* opNames) { OperationList ops = p->operations(); for(OperationList::const_iterator r = ops.begin(); r != ops.end(); ++r) @@ -5382,7 +5345,7 @@ Slice::Gen::TieVisitor::writeOperations(const ClassDefPtr& p, NameSet* opNames) ClassList bases = p->bases(); for(ClassList::const_iterator i = bases.begin(); i != bases.end(); ++i) { - writeOperations(*i, &opNames); + writeTieOperations(*i, &opNames); } } else @@ -5390,7 +5353,7 @@ Slice::Gen::TieVisitor::writeOperations(const ClassDefPtr& p, NameSet* opNames) ClassList bases = p->bases(); for(ClassList::const_iterator i = bases.begin(); i != bases.end(); ++i) { - writeOperations(*i, opNames); + writeTieOperations(*i, opNames); } } } diff --git a/cpp/src/slice2cs/Gen.h b/cpp/src/slice2cs/Gen.h index 230c0fd5942..1b3096d415e 100644 --- a/cpp/src/slice2cs/Gen.h +++ b/cpp/src/slice2cs/Gen.h @@ -85,11 +85,11 @@ public: const std::vector<std::string>&, const std::string&, bool, + bool, bool); ~Gen(); void generate(const UnitPtr&); - void generateTie(const UnitPtr&); void generateImpl(const UnitPtr&); void generateImplTie(const UnitPtr&); void generateChecksums(const UnitPtr&); @@ -99,8 +99,8 @@ private: IceUtilInternal::Output _out; IceUtilInternal::Output _impl; - std::vector<std::string> _includePaths; + bool _tie; void printHeader(); @@ -219,18 +219,7 @@ private: { public: - DispatcherVisitor(::IceUtilInternal::Output&); - - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitModuleEnd(const ModulePtr&); - virtual bool visitClassDefStart(const ClassDefPtr&); - }; - - class TieVisitor : public CsVisitor - { - public: - - TieVisitor(::IceUtilInternal::Output&); + DispatcherVisitor(::IceUtilInternal::Output&, bool); virtual bool visitModuleStart(const ModulePtr&); virtual void visitModuleEnd(const ModulePtr&); @@ -240,7 +229,9 @@ private: private: typedef std::set<std::string> NameSet; - void writeOperations(const ClassDefPtr&, NameSet* = 0); + void writeTieOperations(const ClassDefPtr&, NameSet* = 0); + + bool _tie; }; class BaseImplVisitor : public CsVisitor diff --git a/cpp/src/slice2cs/Main.cpp b/cpp/src/slice2cs/Main.cpp index 2268eb1fa0a..e9a18c20d6a 100644 --- a/cpp/src/slice2cs/Main.cpp +++ b/cpp/src/slice2cs/Main.cpp @@ -68,16 +68,18 @@ usage(const string& n) "-IDIR Put DIR in the include file search path.\n" "-E Print preprocessor output on stdout.\n" "--output-dir DIR Create files in the directory DIR.\n" - "--tie Generate TIE classes.\n" + "--tie Generate tie classes.\n" "--impl Generate sample implementations.\n" - "--impl-tie Generate sample TIE implementations.\n" + "--impl-tie Generate sample tie implementations.\n" "--depend Generate Makefile dependencies.\n" "--depend-xml Generate dependencies in XML format.\n" "--depend-file FILE Write dependencies to FILE instead of standard output.\n" "-d, --debug Print debug messages.\n" - "--ice Allow reserved Ice prefix in Slice identifiers.\n" - "--underscore Allow underscores in Slice identifiers.\n" "--checksum Generate checksums for Slice definitions.\n" + "--ice Allow reserved Ice prefix in Slice identifiers\n" + " deprecated: use instead [[\"ice-prefix\"]] metadata.\n" + "--underscore Allow underscores in Slice identifiers\n" + " deprecated: use instead [[\"underscore\"]] metadata.\n" ; } @@ -309,12 +311,8 @@ compile(const vector<string>& argv) { try { - Gen gen(icecpp->getBaseName(), includePaths, output, impl, implTie); + Gen gen(icecpp->getBaseName(), includePaths, output, tie, impl, implTie); gen.generate(p); - if(tie) - { - gen.generateTie(p); - } if(impl) { gen.generateImpl(p); diff --git a/cpp/src/slice2html/Main.cpp b/cpp/src/slice2html/Main.cpp index 818882ceb61..1bc84b6bde9 100644 --- a/cpp/src/slice2html/Main.cpp +++ b/cpp/src/slice2html/Main.cpp @@ -80,8 +80,10 @@ usage(const string& n) "--index NUM Generate subindex if it has at least NUM entries (0 for no index, default=1).\n" "--summary NUM Print a warning if a summary sentence exceeds NUM characters.\n" "-d, --debug Print debug messages.\n" - "--ice Allow reserved Ice prefix in Slice identifiers.\n" - "--underscore Allow underscores in Slice identifiers.\n" + "--ice Allow reserved Ice prefix in Slice identifiers\n" + " deprecated: use instead [[\"ice-prefix\"]] metadata.\n" + "--underscore Allow underscores in Slice identifiers\n" + " deprecated: use instead [[\"underscore\"]] metadata.\n" ; } diff --git a/cpp/src/slice2java/GenCompat.cpp b/cpp/src/slice2java/GenCompat.cpp index 205d4093750..43205b19db6 100644 --- a/cpp/src/slice2java/GenCompat.cpp +++ b/cpp/src/slice2java/GenCompat.cpp @@ -2199,10 +2199,11 @@ Slice::JavaCompatVisitor::writeDocCommentParam(Output& out, const OperationPtr& } } -Slice::GenCompat::GenCompat(const string& /*name*/, const string& base, const vector<string>& includePaths, const string& dir) : +Slice::GenCompat::GenCompat(const string& /*name*/, const string& base, const vector<string>& includePaths, const string& dir, bool tie) : _base(base), _includePaths(includePaths), - _dir(dir) + _dir(dir), + _tie(tie) { } @@ -2236,7 +2237,7 @@ Slice::GenCompat::generate(const UnitPtr& p) ProxyVisitor proxyVisitor(_dir); p->visit(&proxyVisitor, false); - DispatcherVisitor dispatcherVisitor(_dir); + DispatcherVisitor dispatcherVisitor(_dir, _tie); p->visit(&dispatcherVisitor, false); AsyncVisitor asyncVisitor(_dir); @@ -2244,13 +2245,6 @@ Slice::GenCompat::generate(const UnitPtr& p) } void -Slice::GenCompat::generateTie(const UnitPtr& p) -{ - TieVisitor tieVisitor(_dir); - p->visit(&tieVisitor, false); -} - -void Slice::GenCompat::generateImpl(const UnitPtr& p) { ImplVisitor implVisitor(_dir); @@ -2461,218 +2455,6 @@ Slice::GenCompat::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurre close(); } -Slice::GenCompat::TieVisitor::TieVisitor(const string& dir) : - JavaCompatVisitor(dir) -{ -} - -bool -Slice::GenCompat::TieVisitor::visitClassDefStart(const ClassDefPtr& p) -{ - string name = p->name(); - ClassList bases = p->bases(); - string package = getPackage(p); - string absolute = getAbsolute(p, "", "_", "Tie"); - string opIntfName = "Operations"; - if(p->isLocal()) - { - opIntfName += "NC"; - } - - // - // Don't generate a TIE class for a non-abstract class - // - if(!p->isAbstract()) - { - return false; - } - - open(absolute, p->file()); - - Output& out = output(); - - // - // Generate the TIE class - // - out << sp << nl << "public class " << '_' << name << "Tie"; - if(p->isInterface()) - { - if(p->isLocal()) - { - out << " implements " << fixKwd(name) << ", Ice.TieBase"; - } - else - { - out << " extends " << '_' << name << "Disp implements Ice.TieBase"; - } - } - else - { - out << " extends " << fixKwd(name) << " implements Ice.TieBase"; - } - - out << sb; - - out << sp << nl << "public _" << name << "Tie()"; - out << sb; - out << eb; - - out << sp << nl << "public _" << name << "Tie(" << '_' << name << opIntfName << " delegate)"; - out << sb; - out << nl << "_ice_delegate = delegate;"; - out << eb; - - out << sp << nl << "public java.lang.Object ice_delegate()"; - out << sb; - out << nl << "return _ice_delegate;"; - out << eb; - - out << sp << nl << "public void ice_delegate(java.lang.Object delegate)"; - out << sb; - out << nl << "_ice_delegate = (_" << name << opIntfName << ")delegate;"; - out << eb; - - out << sp << nl << "public boolean equals(java.lang.Object rhs)"; - out << sb; - out << nl << "if(this == rhs)"; - out << sb; - out << nl << "return true;"; - out << eb; - out << nl << "if(!(rhs instanceof " << '_' << name << "Tie))"; - out << sb; - out << nl << "return false;"; - out << eb; - out << sp << nl << "return _ice_delegate.equals(((" << '_' << name << "Tie)rhs)._ice_delegate);"; - out << eb; - - out << sp << nl << "public int hashCode()"; - out << sb; - out << nl << "return _ice_delegate.hashCode();"; - out << eb; - - if(p->isLocal()) - { - out << sp << nl << "public _" << name << "Tie clone()"; - out.inc(); - out << nl << "throws java.lang.CloneNotSupportedException"; - out.dec(); - out << sb; - out << nl << "return (_" << name << "Tie)super.clone();"; - out << eb; - } - - OperationList ops = p->allOperations(); - for(OperationList::iterator r = ops.begin(); r != ops.end(); ++r) - { - ContainerPtr container = (*r)->container(); - ClassDefPtr cl = ClassDefPtr::dynamicCast(container); - const bool hasAMD = cl->hasMetaData("amd") || (*r)->hasMetaData("amd"); - const bool optionalMapping = useOptionalMapping(*r); - - string opName = hasAMD ? (*r)->name() + "_async" : fixKwd((*r)->name()); - - TypePtr ret = (*r)->returnType(); - string retS = typeToString(ret, TypeModeReturn, package, (*r)->getMetaData(), true, - optionalMapping && (*r)->returnIsOptional()); - - vector<string> params; - vector<string> args; - if(hasAMD) - { - params = getParamsAsync((*r), package, true, true); - args = getArgsAsync(*r); - } - else - { - params = getParams((*r), package, false, optionalMapping); - args = getArgs(*r); - } - - string deprecateReason = getDeprecateReason(*r, cl, "operation"); - - out << sp; - if(!deprecateReason.empty()) - { - out << nl << "@Deprecated"; - out << nl << "@SuppressWarnings(\"deprecation\")"; - } - out << nl << "public " << (hasAMD ? string("void") : retS) << ' ' << opName << spar << params; - if(!p->isLocal()) - { - out << "Ice.Current __current"; - } - out << epar; - - if((*r)->hasMetaData("UserException")) - { - out.inc(); - out << nl << "throws Ice.UserException"; - out.dec(); - } - else - { - ExceptionList throws = (*r)->throws(); - throws.sort(); - throws.unique(); - writeThrowsClause(package, throws); - } - out << sb; - out << nl; - if(ret && !hasAMD) - { - out << "return "; - } - out << "_ice_delegate." << opName << spar << args; - if(!p->isLocal()) - { - out << "__current"; - } - out << epar << ';'; - out << eb; - } - - out << sp << nl << "private " << '_' << name << opIntfName << " _ice_delegate;"; - out << sp << nl << "public static final long serialVersionUID = "; - string serialVersionUID; - if(p->findMetaData("java:serialVersionUID", serialVersionUID)) - { - string::size_type pos = serialVersionUID.rfind(":") + 1; - if(pos == string::npos) - { - ostringstream os; - os << "ignoring invalid serialVersionUID for class `" << p->scoped() << "'; generating default value"; - emitWarning("", "", os.str()); - out << computeSerialVersionUUID(p); - } - else - { - Int64 v = 0; - serialVersionUID = serialVersionUID.substr(pos); - if(serialVersionUID != "0") - { - if(!stringToInt64(serialVersionUID, v)) // conversion error - { - ostringstream os; - os << "ignoring invalid serialVersionUID for class `" << p->scoped() - << "'; generating default value"; - emitWarning("", "", os.str()); - out << computeSerialVersionUUID(p); - } - } - out << v; - } - } - else - { - out << computeSerialVersionUUID(p); - } - out << "L;"; - out << eb; - close(); - - return false; -} - Slice::GenCompat::PackageVisitor::PackageVisitor(const string& dir) : JavaCompatVisitor(dir) { @@ -2770,7 +2552,7 @@ Slice::GenCompat::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) out << "class " << fixKwd(name); out.useCurrentPosAsIndent(); - StringList implements; + StringList implements; bool implementsOnNewLine = true; if(bases.empty() || bases.front()->isInterface()) @@ -2778,7 +2560,7 @@ Slice::GenCompat::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) if(p->isLocal()) { implementsOnNewLine = false; - implements.push_back("java.lang.Cloneable"); + implements.push_back("java.lang.Cloneable"); } else { @@ -3134,28 +2916,28 @@ Slice::GenCompat::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p) if(!p->isInterface()) { - out << sp << nl << "public " << name << nl << "clone()"; - out << sb; - - if(p->isLocal() && !baseClass) - { - out << nl << name << " c = null;"; - out << nl << "try"; - out << sb; - out << nl << "c = (" << name << ")super.clone();"; - out << eb; - out << nl << "catch(CloneNotSupportedException ex)"; - out << sb; - out << nl << "assert false; // impossible"; - out << eb; - out << nl << "return c;"; - - } - else - { - out << nl << "return (" << name << ")super.clone();"; - } - out << eb; + out << sp << nl << "public " << name << nl << "clone()"; + out << sb; + + if(p->isLocal() && !baseClass) + { + out << nl << name << " c = null;"; + out << nl << "try"; + out << sb; + out << nl << "c = (" << name << ")super.clone();"; + out << eb; + out << nl << "catch(CloneNotSupportedException ex)"; + out << sb; + out << nl << "assert false; // impossible"; + out << eb; + out << nl << "return c;"; + + } + else + { + out << nl << "return (" << name << ")super.clone();"; + } + out << eb; } if(p->isInterface() && !p->isLocal()) @@ -3566,7 +3348,7 @@ Slice::GenCompat::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) if(p->usesClasses(false)) { - if(!base || (base && !base->usesClasses(false))) + if(!base || (base && !base->usesClasses(false))) { out << sp << nl << "public boolean" << nl << "__usesClasses()"; out << sb; @@ -5752,48 +5534,252 @@ Slice::GenCompat::ProxyVisitor::visitOperation(const OperationPtr& p) } } -Slice::GenCompat::DispatcherVisitor::DispatcherVisitor(const string& dir) : - JavaCompatVisitor(dir) +Slice::GenCompat::DispatcherVisitor::DispatcherVisitor(const string& dir, bool tie) : + JavaCompatVisitor(dir), + _tie(tie) { } bool Slice::GenCompat::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p) { - if(p->isLocal() || !p->isInterface()) + string name = p->name(); + ClassList bases = p->bases(); + + if(!p->isLocal() && p->isInterface()) { - return false; + string absolute = getAbsolute(p, "", "_", "Disp"); + + open(absolute, p->file()); + + Output& out = output(); + + out << sp; + writeDocComment(out, p, getDeprecateReason(p, 0, p->isInterface() ? "interface" : "class")); + out << nl << "public abstract class _" << name << "Disp extends Ice.ObjectImpl implements " << fixKwd(name); + out << sb; + + out << sp << nl << "protected void" << nl << "ice_copyStateFrom(Ice.Object __obj)"; + out.inc(); + out << nl << "throws java.lang.CloneNotSupportedException"; + out.dec(); + out << sb; + out << nl << "throw new java.lang.CloneNotSupportedException();"; + out << eb; + + writeDispatchAndMarshalling(out, p); + + // + // Avoid serialVersionUID warnings for dispatch classes. + // + out << sp << nl << "public static final long serialVersionUID = 0L;"; + out << eb; + close(); } - string name = p->name(); - ClassList bases = p->bases(); - string absolute = getAbsolute(p, "", "_", "Disp"); + if(_tie || p->hasMetaData("java:tie")) + { + // Tie class - open(absolute, p->file()); + string package = getPackage(p); + string absolute = getAbsolute(p, "", "_", "Tie"); + string opIntfName = "Operations"; + if(p->isLocal()) + { + opIntfName += "NC"; + } - Output& out = output(); + // + // Don't generate a tie class for a non-abstract class + // + if(!p->isAbstract()) + { + return false; + } - out << sp; - writeDocComment(out, p, getDeprecateReason(p, 0, p->isInterface() ? "interface" : "class")); - out << nl << "public abstract class _" << name << "Disp extends Ice.ObjectImpl implements " << fixKwd(name); - out << sb; + open(absolute, p->file()); - out << sp << nl << "protected void" << nl << "ice_copyStateFrom(Ice.Object __obj)"; - out.inc(); - out << nl << "throws java.lang.CloneNotSupportedException"; - out.dec(); - out << sb; - out << nl << "throw new java.lang.CloneNotSupportedException();"; - out << eb; + Output& out = output(); + + // + // Generate the tie class + // + out << sp << nl << "public class " << '_' << name << "Tie"; + if(p->isInterface()) + { + if(p->isLocal()) + { + out << " implements " << fixKwd(name) << ", Ice.TieBase"; + } + else + { + out << " extends " << '_' << name << "Disp implements Ice.TieBase"; + } + } + else + { + out << " extends " << fixKwd(name) << " implements Ice.TieBase"; + } - writeDispatchAndMarshalling(out, p); + out << sb; - // - // Avoid serialVersionUID warnings for dispatch classes. - // - out << sp << nl << "public static final long serialVersionUID = 0L;"; - out << eb; - close(); + out << sp << nl << "public _" << name << "Tie()"; + out << sb; + out << eb; + + out << sp << nl << "public _" << name << "Tie(" << '_' << name << opIntfName << " delegate)"; + out << sb; + out << nl << "_ice_delegate = delegate;"; + out << eb; + + out << sp << nl << "public java.lang.Object ice_delegate()"; + out << sb; + out << nl << "return _ice_delegate;"; + out << eb; + + out << sp << nl << "public void ice_delegate(java.lang.Object delegate)"; + out << sb; + out << nl << "_ice_delegate = (_" << name << opIntfName << ")delegate;"; + out << eb; + + out << sp << nl << "public boolean equals(java.lang.Object rhs)"; + out << sb; + out << nl << "if(this == rhs)"; + out << sb; + out << nl << "return true;"; + out << eb; + out << nl << "if(!(rhs instanceof " << '_' << name << "Tie))"; + out << sb; + out << nl << "return false;"; + out << eb; + out << sp << nl << "return _ice_delegate.equals(((" << '_' << name << "Tie)rhs)._ice_delegate);"; + out << eb; + + out << sp << nl << "public int hashCode()"; + out << sb; + out << nl << "return _ice_delegate.hashCode();"; + out << eb; + + if(p->isLocal()) + { + out << sp << nl << "public _" << name << "Tie clone()"; + out.inc(); + out << nl << "throws java.lang.CloneNotSupportedException"; + out.dec(); + out << sb; + out << nl << "return (_" << name << "Tie)super.clone();"; + out << eb; + } + + OperationList ops = p->allOperations(); + for(OperationList::iterator r = ops.begin(); r != ops.end(); ++r) + { + ContainerPtr container = (*r)->container(); + ClassDefPtr cl = ClassDefPtr::dynamicCast(container); + const bool hasAMD = cl->hasMetaData("amd") || (*r)->hasMetaData("amd"); + const bool optionalMapping = useOptionalMapping(*r); + + string opName = hasAMD ? (*r)->name() + "_async" : fixKwd((*r)->name()); + + TypePtr ret = (*r)->returnType(); + string retS = typeToString(ret, TypeModeReturn, package, (*r)->getMetaData(), true, + optionalMapping && (*r)->returnIsOptional()); + + vector<string> params; + vector<string> args; + if(hasAMD) + { + params = getParamsAsync((*r), package, true, true); + args = getArgsAsync(*r); + } + else + { + params = getParams((*r), package, false, optionalMapping); + args = getArgs(*r); + } + + string deprecateReason = getDeprecateReason(*r, cl, "operation"); + + out << sp; + if(!deprecateReason.empty()) + { + out << nl << "@Deprecated"; + out << nl << "@SuppressWarnings(\"deprecation\")"; + } + out << nl << "public " << (hasAMD ? string("void") : retS) << ' ' << opName << spar << params; + if(!p->isLocal()) + { + out << "Ice.Current __current"; + } + out << epar; + + if((*r)->hasMetaData("UserException")) + { + out.inc(); + out << nl << "throws Ice.UserException"; + out.dec(); + } + else + { + ExceptionList throws = (*r)->throws(); + throws.sort(); + throws.unique(); + writeThrowsClause(package, throws); + } + out << sb; + out << nl; + if(ret && !hasAMD) + { + out << "return "; + } + out << "_ice_delegate." << opName << spar << args; + if(!p->isLocal()) + { + out << "__current"; + } + out << epar << ';'; + out << eb; + } + + out << sp << nl << "private " << '_' << name << opIntfName << " _ice_delegate;"; + out << sp << nl << "public static final long serialVersionUID = "; + string serialVersionUID; + if(p->findMetaData("java:serialVersionUID", serialVersionUID)) + { + string::size_type pos = serialVersionUID.rfind(":") + 1; + if(pos == string::npos) + { + ostringstream os; + os << "ignoring invalid serialVersionUID for class `" << p->scoped() << "'; generating default value"; + emitWarning("", "", os.str()); + out << computeSerialVersionUUID(p); + } + else + { + Int64 v = 0; + serialVersionUID = serialVersionUID.substr(pos); + if(serialVersionUID != "0") + { + if(!stringToInt64(serialVersionUID, v)) // conversion error + { + ostringstream os; + os << "ignoring invalid serialVersionUID for class `" << p->scoped() + << "'; generating default value"; + emitWarning("", "", os.str()); + out << computeSerialVersionUUID(p); + } + } + out << v; + } + } + else + { + out << computeSerialVersionUUID(p); + } + out << "L;"; + out << eb; + close(); + } return false; } diff --git a/cpp/src/slice2java/GenCompat.h b/cpp/src/slice2java/GenCompat.h index c03d491f380..a55841a43c9 100644 --- a/cpp/src/slice2java/GenCompat.h +++ b/cpp/src/slice2java/GenCompat.h @@ -127,11 +127,11 @@ public: GenCompat(const std::string&, const std::string&, const std::vector<std::string>&, - const std::string&); + const std::string&, + bool); ~GenCompat(); void generate(const UnitPtr&); - void generateTie(const UnitPtr&); void generateImpl(const UnitPtr&); void generateImplTie(const UnitPtr&); @@ -142,6 +142,7 @@ private: std::string _base; std::vector<std::string> _includePaths; std::string _dir; + bool _tie; class OpsVisitor : public JavaCompatVisitor { @@ -155,15 +156,6 @@ private: void writeOperations(const ClassDefPtr&, bool); }; - class TieVisitor : public JavaCompatVisitor - { - public: - - TieVisitor(const std::string&); - - virtual bool visitClassDefStart(const ClassDefPtr&); - }; - class PackageVisitor : public JavaCompatVisitor { public: @@ -253,9 +245,12 @@ private: { public: - DispatcherVisitor(const std::string&); + DispatcherVisitor(const std::string&, bool); virtual bool visitClassDefStart(const ClassDefPtr&); + + private: + bool _tie; }; class BaseImplVisitor : public JavaCompatVisitor diff --git a/cpp/src/slice2java/Main.cpp b/cpp/src/slice2java/Main.cpp index d864279a544..80fec0c32a0 100644 --- a/cpp/src/slice2java/Main.cpp +++ b/cpp/src/slice2java/Main.cpp @@ -70,19 +70,21 @@ usage(const string& n) "-IDIR Put DIR in the include file search path.\n" "-E Print preprocessor output on stdout.\n" "--output-dir DIR Create files in the directory DIR.\n" - "--tie Generate TIE classes.\n" + "--tie Generate tie classes.\n" "--impl Generate sample implementations.\n" - "--impl-tie Generate sample TIE implementations.\n" + "--impl-tie Generate sample tie implementations.\n" "--depend Generate Makefile dependencies.\n" "--depend-xml Generate dependencies in XML format.\n" "--depend-file FILE Write dependencies to FILE instead of standard output.\n" "--list-generated Emit list of generated files in XML format.\n" "-d, --debug Print debug messages.\n" - "--ice Allow reserved Ice prefix in Slice identifiers.\n" - "--underscore Allow underscores in Slice identifiers.\n" "--checksum CLASS Generate checksums for Slice definitions into CLASS.\n" "--meta META Define global metadata directive META.\n" "--compat Use the backward-compatible language mapping.\n" + "--ice Allow reserved Ice prefix in Slice identifiers\n" + " deprecated: use instead [[\"ice-prefix\"]] metadata.\n" + "--underscore Allow underscores in Slice identifiers\n" + " deprecated: use instead [[\"underscore\"]] metadata.\n" ; } @@ -363,12 +365,8 @@ compile(const vector<string>& argv) { if(compat) { - GenCompat gen(argv[0], icecpp->getBaseName(), includePaths, output); + GenCompat gen(argv[0], icecpp->getBaseName(), includePaths, output, tie); gen.generate(p); - if(tie) - { - gen.generateTie(p); - } if(impl) { gen.generateImpl(p); diff --git a/cpp/src/slice2js/Main.cpp b/cpp/src/slice2js/Main.cpp index 862e1343e02..a4d9023395c 100644 --- a/cpp/src/slice2js/Main.cpp +++ b/cpp/src/slice2js/Main.cpp @@ -74,8 +74,10 @@ usage(const string& n) "--depend-xml Generate dependencies in XML format.\n" "--depend-file FILE Write dependencies to FILE instead of standard output.\n" "-d, --debug Print debug messages.\n" - "--ice Allow reserved Ice prefix in Slice identifiers.\n" - "--underscore Allow underscores in Slice identifiers.\n" + "--ice Allow reserved Ice prefix in Slice identifiers\n" + " deprecated: use instead [[\"ice-prefix\"]] metadata.\n" + "--underscore Allow underscores in Slice identifiers\n" + " deprecated: use instead [[\"underscore\"]] metadata.\n" ; } diff --git a/cpp/src/slice2objc/Gen.cpp b/cpp/src/slice2objc/Gen.cpp index 9d51de398e4..794570bc4d0 100644 --- a/cpp/src/slice2objc/Gen.cpp +++ b/cpp/src/slice2objc/Gen.cpp @@ -690,6 +690,21 @@ Slice::Gen::generate(const UnitPtr& p) { ObjCGenerator::validateMetaData(p); + // + // Give precedence to --dll-export command-line option + // + if(_dllExport.empty()) + { + DefinitionContextPtr dc = p->findDefinitionContext(p->topLevelFile()); + assert(dc); + static const string dllExportPrefix = "objc:dll-export:"; + string meta = dc->findMetaData(dllExportPrefix); + if(meta.size() > dllExportPrefix.size()) + { + _dllExport = meta.substr(dllExportPrefix.size()); + } + } + _H << sp << nl << "#import <objc/Ice/Config.h>"; if(p->hasNonLocalClassDecls()) { diff --git a/cpp/src/slice2objc/Main.cpp b/cpp/src/slice2objc/Main.cpp index c8d68d39bf1..4d0df1c8a59 100644 --- a/cpp/src/slice2objc/Main.cpp +++ b/cpp/src/slice2objc/Main.cpp @@ -68,13 +68,16 @@ usage(const string& n) "-E Print preprocessor output on stdout.\n" "--include-dir DIR Use DIR as the header include directory in source files.\n" "--output-dir DIR Create files in the directory DIR.\n" - "--dll-export SYMBOL Use SYMBOL for DLL exports.\n" "--depend Generate Makefile dependencies.\n" "--depend-xml Generate dependencies in XML format.\n" "--depend-file FILE Write dependencies to FILE instead of standard output.\n" "-d, --debug Print debug messages.\n" - "--ice Allow reserved Ice prefix in Slice identifiers.\n" - "--underscore Allow underscores in Slice identifiers.\n" + "--dll-export SYMBOL Use SYMBOL for DLL exports\n" + " deprecated: use instead [[\"objc:dll-export:SYMBOL\"]] metadata.\n" + "--ice Allow reserved Ice prefix in Slice identifiers\n" + " deprecated: use instead [[\"ice-prefix\"]] metadata.\n" + "--underscore Allow underscores in Slice identifiers\n" + " deprecated: use instead [[\"underscore\"]] metadata.\n" ; // Note: --case-sensitive is intentionally not shown here! } diff --git a/cpp/src/slice2objc/ObjCUtil.cpp b/cpp/src/slice2objc/ObjCUtil.cpp index 8247915d841..852af9ba2af 100644 --- a/cpp/src/slice2objc/ObjCUtil.cpp +++ b/cpp/src/slice2objc/ObjCUtil.cpp @@ -1058,6 +1058,7 @@ Slice::ObjCGenerator::MetaDataVisitor::visitUnitStart(const UnitPtr& p) assert(dc); StringList globalMetaData = dc->getMetaData(); int headerDir = 0; + int dllExport = 0; for(StringList::const_iterator r = globalMetaData.begin(); r != globalMetaData.end(); ++r) { string s = *r; @@ -1066,6 +1067,7 @@ Slice::ObjCGenerator::MetaDataVisitor::visitUnitStart(const UnitPtr& p) if(s.find(_objcPrefix) == 0) { static const string objcHeaderDirPrefix = "objc:header-dir:"; + static const string objcDllExportPrefix = "objc:dll-export:"; if(s.find(objcHeaderDirPrefix) == 0 && s.size() > objcHeaderDirPrefix.size()) { headerDir++; @@ -1079,6 +1081,19 @@ Slice::ObjCGenerator::MetaDataVisitor::visitUnitStart(const UnitPtr& p) } continue; } + else if(s.find(objcDllExportPrefix) == 0 && s.size() > objcDllExportPrefix.size()) + { + dllExport++; + if(dllExport > 1) + { + ostringstream ostr; + ostr << "ignoring invalid global metadata `" << s + << "': directive can appear only once per file"; + emitWarning(file, -1, ostr.str()); + _history.insert(s); + } + continue; + } ostringstream ostr; ostr << "ignoring invalid global metadata `" << s << "'"; emitWarning(file, -1, ostr.str()); diff --git a/cpp/src/slice2php/Main.cpp b/cpp/src/slice2php/Main.cpp index d7b83782349..e5cb1ba7654 100644 --- a/cpp/src/slice2php/Main.cpp +++ b/cpp/src/slice2php/Main.cpp @@ -1517,11 +1517,13 @@ usage(const string& n) "--depend-xml Generate dependencies in XML format.\n" "--depend-file FILE Write dependencies to FILE instead of standard output.\n" "-d, --debug Print debug messages.\n" - "--ice Allow reserved Ice prefix in Slice identifiers.\n" - "--underscore Allow underscores in Slice identifiers.\n" "--all Generate code for Slice definitions in included files.\n" "--checksum Generate checksums for Slice definitions.\n" "-n, --namespace Use PHP namespaces (requires PHP 5.3 or later).\n" + "--ice Allow reserved Ice prefix in Slice identifiers\n" + " deprecated: use instead [[\"ice-prefix\"]] metadata.\n" + "--underscore Allow underscores in Slice identifiers\n" + " deprecated: use instead [[\"underscore\"]] metadata.\n" ; } |