Page 1 of 1

[Implemented] CompilerWarning

Posted: Sun Mar 08, 2015 4:33 am
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

Re: CompilerWarning

Posted: Sun Mar 08, 2015 6:15 am
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.

Re: CompilerWarning

Posted: Sun Mar 08, 2015 7:10 am
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.

Re: CompilerWarning

Posted: Sun Mar 08, 2015 3:14 pm
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

Re: CompilerWarning

Posted: Sun Mar 08, 2015 6:09 pm
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).