How to force Delphi compiler to display all hints and warnings - delphi

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.

Related

How do I tell Delphi to use the local project's Security.pas file rather than Winapi.Security.pas in DXS?

Delphi 10 Seattle introduces Winapi.Security.pas. The project (a package) I'm trying to upgrade already has a Security.pas file. Short of removing Winapi from the list of scope names for the project (huge undesirable ripple effect), is there a way to tell the IDE and compiler to use the project's Security.pas file instead of Winapi.Security.pas?
I already tried renaming the projects Security.pas, but that caused even more problems with the compiler generating errors that have nothing to do with the code it was complaining about, so that's a rathole I'd rather not go down right now. This project builds just fine unchanged in XE7, FWIW, so this isn't due to any code changes in the project.
Updates:
Renaming the file and using a unit alias doesn't work.
The compiler behavior for a package differs from an application.
Looks like this might actually be related to the Winapi.Security unit rather than something as generic as you suggest in the question. For instance, the following package compiles just fine:
package Package1;
requires
rtl;
contains
Windows in 'Windows.pas'; // blank unit named Windows.pas in project folder
end.
Note that I have, like you, included Winapi in the project's list of unit scope names.
On the other hand, this package does not compile:
package Package1;
requires
rtl;
contains
Security in 'Security.pas'; // blank unit named Security.pas in project folder
end.
The compiler fails with:
[dcc32 Error] Package1.dpk(7): E2200 Package 'rtl' already contains unit 'Winapi.Security'
If the issue was purely related to unit scope names then either both packages would compile, or both would fail. Hence my conclusion that there is something out of whack with Winapi.Security.
I can find no source code for Winapi.Security. I wonder what it actually is. [Nicholas Ring located the source for me, inside the rtl\win\winrt directory.]
Anyway, I think it's time to submit a QP report. The package below that fails to compile is probably the starting point for that QP report. [Your submitted report is here RSP-12469.]
It seems clear to me that in the short term you must rename your unit if you wish to adopt Seattle.
FWIW, here are some other units that behave the same way as Winapi.Security:
Winapi.ApplicationModel
Winapi.CommonTypes
Winapi.Devices
Winapi.Foundation
Winapi.Gaming
Winapi.Globalization
Winapi.GraphicsRT
Winapi.Management
Winapi.Media
Winapi.Networking
Winapi.Storage
Winapi.UI
Winapi.WebRT
These are all newly added WinRT units which I expect is important.
If you put both Winapi.Security and your local Security in the same uses clause then you are able to access the members of both of them without issue. If you put them in separate uses clauses (Interface vs. Implementation) then you will get the error:
E2004 Identifier redeclared: 'Winapi.Security'
If I only include Security.pas in the uses clause (and it is included in the project) then it accesses its members just fine.
Perhaps I need more information about what error you are running into? I'll send you a sample project that shows this working.
I might well be wrong, but I believe that if Security.pas is in the uses clause of the dpr file, along with its full path, it will be preferred over whichever file can be found via the namespaces and search paths.
Open project settings, in the Delphi Compiler section remove "Winapi" from "Unit scope names".
This way, when you need the Security unit shipped with Delphi, you'll have to write Winapi.Security, and if you write Security, it will use your custom Security unit.

delphi d2009 update 3 dcc32 build options. Win XP

I have a seemingly unsolvable (to me!) problem.
If I start a simple vcl forms app and try to compile, I get multiple warning/errors as follows :
[DCC Warning] SysUtils.pas(6082): W1000 Symbol 'SInvalidInteger' is deprecated: 'Use SysConsts.SInvalidInteger'
etc.
[DCC Fatal Error] Variants.pas(1071): F2092 Program or unit 'Variants' recursively uses itself
The library path options both in the global and project sections seem Ok,
but if I hover over the dcc32.exe build or output messages, I can see a vast selection of
paths which are not relevant and also are repeated about 3 times.
The dcc32.cfg is quite short and seems Ok.
It looks like the path is corrupt somehow and although I've reinstalled D2009 (after deleting the program) and also cleared the registry, I cannot seem to solve this problem.
question : how can I reset or clear this dcc32.exe path - where is the option file, or is it created on the fly?
This problem occurred when I tried to compile a D7 project/or added JCL/jvcl (now removed)
Thanks for any ideas!

How do I stop the debugger from stepping into Delphi-supplied units?

The debugger steps into the source code on errors (like with F7), but I want to restore the normal working mode where the Delphi basic DCUs (the library) are only compiled into my code, and the sources are not used in debugging.
For example, on an error in my program, the debugger is stepping into Controls.pas, into TControl.Click. The normal case (right after installation) is for Delphi to step over these methods.
Should I recompile Controls.pas without debug information? If so, how?
I extending this theme with additional information to better understanding:
We use Delphi6 Prof. what have problem with Mouse (System Error Code 5).
So we want to recompile to Controls.pas to replace the Mouse Position getter code.
Then:
I created a folder for it: "c:\D\Common\Delphi_Patches\Delphi_6\"
I put the original Controls.pas into it.
I modified the Controls.pas, replaced the position getter code.
I set the Delphi's Library path, set the first folder to "c:\D\Common\Delphi_Patches\Delphi_6\"
With these steps I can compiled the source with mouse-safe code.
Ok, but then the Delphi everytime steps into Controls.pas on F7, and on any exceptions - this is very "angermaker" thing.
No matter that I removed the "Controls.pas" from the Library path - then the debugger is finding the original "Controls.pas" for it, and opens it... :-(
We don't use "Use Debug DCU-s" in any codes.
I tried to remove "Debug Information" from compiler options, but it is no matter, the Delphi is opens the original Controls.pas...
So I search the way to Delphi don't step into "Controls.pas", but use my dcu...
I hope this provide better context to understand the problem.
I think that you need to Shift+Ctrl+F11 (tools/options) then in Compiler, uncheck "Use debug DCU"...Then if an exception occurs it wont break into the RTL or VCL sources.
Since you are compiling your own version of a Delphi unit, you can disable debug info in that unit. Add {$D-} to the source code of the unit(s) in question.
As I see the solution is:
create a project the uses only the new Controls.pas.
unset the "Debug information" option in compiler options.
build dcu
put the dcu into a library folder
hide the new Controls.pas from this library folders.
Wite this trick the I cannot "step into" controls.pas.
Regards: dd
I had this same problem with Delphi XE8.
You can untick the "Project >> Option >> Compiling >> Use debug .dcus" and it will continue tracing into System unit and so on.
I found that the best way to stop this is to open your Application.dproj file - which is in XML. In it, you can change the settings as follows:
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<DCC_AssertionsAtRuntime>false</DCC_AssertionsAtRuntime> <--- note false
<DCC_DebugDCUs>false</DCC_DebugDCUs>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<DCC_RemoteDebug>false</DCC_RemoteDebug>
</PropertyGroup>

Delphi - compiler continue on error

Is there any possibility to make compiler continue when errors are encountered during the compilation an application in D2006? I want to know how many errors it finds on an application.
No there is not. The problem is that once the compiler can't compile one unit, it's in no position to compile the other ones that, more than likely, depend on the unit that could not be compiled. This is because compilation of a unit requires a .dcu file for all of the used units.

Unit SysUtils was compiled with a different version of SysConst.SMonitorLockException when trying to compile project in Delphi 2009

I'm trying to compile a project and I'm getting this error.
The error occurs in a RemObjects source file, but I think it doesn't have anything to do with RemObjects.
Anyway this error is too generic, and I don't quite get why it happens, so how can I solve it?
The problem was that we translated the unit SysConsts and the Interface changed, removing that unit solved the problem.
This error occurs if you mix libraries. You are probably using a (third-party) library that is compiled with a different version. Try to get the latest version, or recompile if you have the source.
If the problem persists, try to get a minimal subset of the project to find the offending unit / dcu file.

Resources