On 01.05.2012 13:57, Martin Schreiber wrote:
On Tuesday 01 May 2012 13:50:49 Sven Barth wrote:
On 01.05.2012 13:50, Martin Schreiber wrote:
Anyway, the change is undone, we're back on TBookmarkStr.
TBookMarkStr is now marked deprecated. Revision 21155.

Thank you very much. That means it is not possible to work with fixes_2_6
without "deprecated" warnings? TDataset.Bookmark is of type TBookmarkStr
but TBookmarkStr is deprecated?

Exactly. These were added to remind everyone who uses TBookmarkStr that
there WILL be a change after 2.6.2 has been released (thus in 2.6.3) as
Michael explained.

What do you suggest to avoid the warning?

You can locally disable warnings by using the $warn directive (not documented yet it seems, but available in 2.6.0).

It looks like this:

{$warn MSGID (on|off|error)}

* on: MSGID will be emitted as a warning
* off: MSGID will not be emitted
* error: MSGID will be emitted as an error (and handled as such by the compiler!)

You can find out the MSGID by passing "-vq" to the compiler then it will additionally print the ID for each message it writes. For the case of "deprecated" there are two message IDs: One which is used if a custom message is given and one for the other case. For the first the ID is 5066 and for the latter 5043.

The following is a demonstration of the potential usage of $warn:

=== example begin ===

program warntest;

{$mode objfpc}

type
  TTest = class
    procedure Test; deprecated 'Test';
  end;

procedure TTest.Test;
begin

end;

var
  t: TTest;
begin
{$push} // <= used to restore the state afterwards; you could use {$warn 5066 on} as well
{$warn 5066 off}
  t.Test; // here no warning will be emitted
{$pop}
  t.Test; // here a warning will be emitted
end.

=== example end ===

Alternatively you can also use

{$warn symbol_deprecated off}

which will switch of both custom and non-custom deprecated messages for symbols (units have an extra name).

Here is a list of all those recognized identifiers (out of Delphi compatibility):

CONSTRUCTING_ABSTRACT
IMPLICIT_VARIANTS
NO_RETVAL
SYMBOL_DEPRECATED
SYMBOL_EXPERIMENTAL
SYMBOL_LIBRARY
SYMBOL_PLATFORM
SYMBOL_UNIMPLEMENTED
UNIT_DEPRECATED
UNIT_EXPERIMENTAL
UNIT_LIBRARY
UNIT_PLATFORM
UNIT_UNIMPLEMENTED
ZERO_NIL_COMPAT
IMPLICIT_STRING_CAST
IMPLICIT_VARIANTS
NO_RETVAL
SYMBOL_DEPRECATED
SYMBOL_EXPERIMENTAL
SYMBOL_LIBRARY
SYMBOL_PLATFORM
SYMBOL_UNIMPLEMENTED
UNIT_DEPRECATED
UNIT_EXPERIMENTAL
UNIT_LIBRARY
UNIT_PLATFORM
UNIT_UNIMPLEMENTED
ZERO_NIL_COMPAT
IMPLICIT_STRING_CAST
IMPLICIT_STRING_CAST_LOSS
EXPLICIT_STRING_CAST
EXPLICIT_STRING_CAST_LOSS
CVT_NARROWING_STRING_LOST

Regards,
Sven
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to