[Implemented] CompilerWarning

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

[Implemented] CompilerWarning

Post by StarBootics »

Hello,

CompilerError generate an error message and stop compiling the source code. It' nice in some case but I need sometthing that will just tell me something and continue the compiling process.

So I suggest to add CompilerWarning keyword for this purpose.

Something like this will be useful for telling about Deprecated user procedures for example.

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: CompilerWarning

Post by Demivec »

StarBootics wrote:CompilerError generate an error message and stop compiling the source code. It' nice in some case but I need sometthing that will just tell me something and continue the compiling process.

So I suggest to add CompilerWarning keyword for this purpose.

Something like this will be useful for telling about Deprecated user procedures for example.
Settings for things like this (i.e. stop, warnings only, or ignore) are already available in the Debugger.

IMHO you wouldn't want to make compiler errors optional as they are usually show stoppers.
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: CompilerWarning

Post by Danilo »

Could be useful for a library if you deprecate a function before it gets removed in a later version.

+1 for CompilerWarning / CompilerOutput / CompilerPrint / CompilerMessage. Just outputs a message without abortion, independent from any settings.
Could even be a license or copyright message, whatever.
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: CompilerWarning

Post by StarBootics »

Another use for CompilerWarning

Code: Select all

DeclareModule Matrix44

   ... 

  Declare Product(*MatrixR.Matrix44, *MatrixA.Matrix44, *MatrixB.Matrix44)
  Declare ProductEx(*MatrixR.Matrix44, *MatrixA.Matrix44, *MatrixB.Matrix44)
  Declare ProductByScalar(*MatrixR.Matrix44, *MatrixA.Matrix44, Scalar.f)
  Declare DivideByScalar(*MatrixR.Matrix44, *MatrixA.Matrix44, Scalar.f)
  Declare.f Determinant(*MatrixA.Matrix44)

  Declare Translation(*Trans.Matrix44, Trans_x.f, Trans_y.f, Trans_z.f)
  Declare Scale(*Scale.Matrix44, Scale_x.f, Scale_y.f, Scale_z.f)
  
  Declare RotateX(*RotateX.Matrix44, Theta.f)
  Declare RotateY(*RotateY.Matrix44, Theta.f)
  Declare RotateZ(*RotateZ.Matrix44, Theta.f)
  
  CompilerIf Defined(Vector3, #PB_Module)
    
    Declare TranslationEx(*Trans.Matrix44, *VectorA.Vector3::Vector3)
    Declare ScaleEx(*Scale.Matrix44, *VectorA.Vector3::Vector3)
    Declare LookAtMatrix(*LookAt.Matrix44, P_EyeX.f, P_EyeY.f, P_EyeZ.f, P_CenterX.f, P_CenterY.f, P_CenterZ.f, P_UpX.f, P_UpY.f, P_UpZ.f)
    Declare LookAtMatrixEx(*LookAt.Matrix44, *Eye.Vector3::Vector3, *Center.Vector3::Vector3, *Up.Vector3::Vector3)
    
    CompilerIf Defined(Vector4, #PB_Module)
      Declare ProductMatrixVector(*VectorR.Vector4::Vector4, *MatrixA.Matrix44, *VectorB.Vector4::Vector4)
      Declare ApplyTransformation(*Transformation.Matrix44, *NewPoint.Vector3::Vector3, *Point.Vector3::Vector3)
    CompilerElse
      CompilerWarning "Vector4 Module should be included before Matrix44 Module"
    CompilerEndIf
    
  CompilerElse
    
    CompilerWarning "Vector3 Module should be included before Matrix44 Module "
    
  CompilerEndIf
  
  CompilerIf Defined(Quaternion, #PB_Module)
    Declare MakeMatrixFromQuaternion(*QuaternionA.Quaternion::Quaternion, *Rotation.Matrix44)
  CompilerElse
    CompilerWarning "Quaternion Module should be included before Matrix44 Module "
  CompilerEndIf
  
EndDeclareModule
I confess, I'm now a MAPP (Module Addicted Purebasic Programmer)

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
kenmo
Addict
Addict
Posts: 2033
Joined: Tue Dec 23, 2003 3:54 am

Re: CompilerWarning

Post by kenmo »

+1

I requested the same thing in 2012 :)
http://www.forums.purebasic.com/english ... =3&t=50664
ts-soft posted a nice method to do this, using Import.

In other languages, I use compiler warnings all the time (for example: to indicate that Debugging features are still enabled, and should be disabled for final builds).
Post Reply