As you know in Delphi we can use Deprecated directive to say a method or ... is obsolete or supported only for backward compatibility and we can use Experimental directive to say current unit are in an unstable development state .
Deprecated & Experimental directives work properly in form,s unit , but when we use it on unit that we add to application manualy they don,t work and when compile application don,t show any warning message in message window .
May i should enable any directive like {$HINTS ON} or {$WARNINGS ON} in that unit ?
Any one can help me ?
Thanks alot .
I think you've answered the question yourself. These directives make the compiler emit warnings, but only if warnings are enabled at that point in the compilation. Note that these symbols produce warnings rather than hints.
I personally configure the compiler to treat the use of deprecated symbols as an error rather than a warning.
Related
In Delphi we have multiple warn the compiler the provide to protect you do do something bad. Some are errors other warns etc.
I want to turn off the Warn for SYMBOL_DEPRECATED for all my files in the project.
But I just found ways to do it by file ?
Project->Options->Hints and Warnings from the menu.
Change Deprecated Symbol in the list to False. You'll need to do it for each target (Debug Win32, Release Win32, etc.), as they're maintained separately.
(Not sure why you'd want to do that, BTW. Deprecated symbol warnings are meaningful, as opposed to the Platform Unit when you're clearly doing a VCL Windows app and not FMX. You should heed deprecated symbol warnings, as those mean that code can break in the future and you're not prepared.)
NSDeprecated which tunnels through CF_Deprecated into the clang attribute availability only handles deprecation for MACOSX and IOS.
Are there any calls or series of macros that replicate this tool for third parties.
I am working on V2 of an SDK and there are certain calls we want to deprecate as well as EOL.
(Please note, this SDK is still in Objective-C; so Swift only solutions don't solve my issue)
The deprecation warnings and errors would be fantastic at compilation and code generation time; however, I fear this is something I'd need to spin on my own.
Any pointers or reference on this before I have to decide if I need to kill the time on this side project?
You can #define a macro in your SDK project to make a shorthand for the deprecation message. We did something similar in the Core Plot project.
There is a function attribute deprecated provided by GNU compiler.
The syntax to mark deprecated functions is:
void Foo() __attribute__( (deprecated("message", "replacement")) );
The first one is the message to display when emitting the warning; the second one enables the compiler to provide a Fix-It to replace the deprecated name with a new name.
More information on using function attributes can be found in GCC Attribute Syntax documentation or Attributes in Clang documentation
some handy macros are in the NSObjCRuntime.h from Apple.
NS_DEPRECATED_IOS(6.0,10.0)
works like a charm.
When compiling my application, there is a compiler warning:
[DCC Warning] ... W1002 Symbol 'IncludeTrailingBackslash' is specific to a platform
How do I avoid this warning?
Delphi XE2 has another function IncludeTrailingPathDelimiter which can be used in place of IncludeTrailingBackslash. This function is supported on any platform that Delphi supports.
To avoid the warning, turn it off in the config dialog. This turns off all other plattform specific warnings as well, which might be helpfull, as you are not going to develop Linux-Apps anyway, I assume.
To get around the warning, use another function (IncludeTrailingPathDelimiter) as you suggested.
Why does the Dart2JS compiler not generate code that includes "use strict" at the top of each of the script files? If all generated Javascript code is valid ECMA5 code, then shouldn't the compiler automatically add the "use strict" command?
Update:
Apparently this is already being tracked by issue 1686.
To formally answer, this feature request can be found in issue 1686 in the Dart issue tracker.
As for why, there hasn't been much demand for it and the dart2js team has been focused on language conformance and performance.
Is there a way to force the Delphi compiler to display all hints and warnings all the time?
Here is the behavior that I am currently seeing in Delphi 6:
Check out fresh copy of my application from source control
Open project in Delphi and Compile
All hints and warnings for the project are displayed
Make a change in one unit
Compile
Only the hints and warnings for the changed unit are displayed
So, I thought maybe I can trick Delphi by deleting all of the dcu files to force it to recompile everything. No luck. The compiler does in fact recompile all of the units, but does not display the hints and warnings for those units.
EDIT: Performing a full build (Project > Build) yields the same unfortunate results.
NEW INFORMATION: If I modify a unit and then Compile, I get the warnings. However, if I modify a unit and then Build, I do not get the warnings. I'm thinking this points to warnings being turned off somewhere. Possibly in a third party library?
It seems there ought to be a way to ask Delphi to re-display all of those hints and warnings that doesn't require me to either check out a fresh copy from source control or modify each unit one-by-one.
Hints and Warnings are generated by the compiler. It will only report on units that it has compiled. The "compile" command will only compile files that have changed. To force a recompilation of all units used by your project, use the Build command instead.
Later versions assign a shortcut key (Shift+F9) to the "Build" command.
To get that keyboard shortcut in Delphi 6, install this utility, which I've used for a while with great success on Delphi 5.
I would check to see if you turn the warnings off in some of your units.
Depending on the last change in the units, the compiling order can change. In some cases the warnings can remain disabled for a unit that is compiled after while, when freshly checked out of version control, it was compiled before, with the warnings.
Pay extra attention to any Include file you may use.
I had the same problem and finally i found solution... Search for strings $WARNINGS OFF and $HINTS OFF, and not just from *.pas files but from all the files. I had this strange idea in third-party .inc file:
{$IFDEF DEBUG}
{$WARNINGS ON}
{$HINTS ON}
{$ELSE}
{$WARNINGS OFF}
{$HINTS OFF}
{$ENDIF}
If you use dcc32.exe, all warnings will be shown, always. (This is another reason why I use build scripts for all my projects.)
I am still using D6 for some projects and if I do a full build then all hints and warnings are displayed/re-displayed. For syntax check or compile only changed unit messages are displayed.
You have something else wrong or damaged somewhere. Try deleting the project .dsm and the .dof files (they will be rebuilt) the .dof file contains the warnings and hints flags.