×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    May 2003
    Posts
    96

    CodeWarrior compiler customization?

    Is the CodeWarrior compiler customizable?
    Reading documents supplied with the tool (CodeWarrior_for_Symbian_OS.pdf, c_porting_guide.pdf) I don’t find anything about that.
    What I mean is:
    . Is there any way to set the warning level? It seems to me that it is just an ON | OFF option and no level can be specified.
    . or about casting, is there anyway to tell the compiler how to threat certain casting? An example.

    I have:

    typedef char CH;
    [..]
    CH* buffer = malloc(CERTAIN_SIZE);

    And I get as error:
    error: invalid conversion from `void*' to `CH*'

    Of course I can explicitly cast
    CH* buffer = (CH*) malloc(CERTAIN_SIZE);

    But since I have plenty of these in the code that I have to deal with… I was wondering if I can set it in the compiler.

    Any hint?
    Mik

  2. #2
    Nokia Developer Expert
    Join Date
    Oct 2004
    Location
    Austin, TX USA
    Posts
    271

    Re: CodeWarrior compiler customization?

    There are not specific compiler warning levels, but if you look at the help for the mwccsym2.exe command line compiler you see that you can enable and disable specific warning messages there by passing parameters to the -w switch, so you have full control over what warnings will be generated.

    You can also customize compiler performance with #pragmas if you'd rather do that. Under Help > CodeWarrior Help > CodeWarrior Documentation > C Compilers Reference you will see sections for Common Pragmas and Intel x86 Pragmas. There are all kinds of warning pragmas that can be enabled and disabled.

    I don't believe there is a way to change the default casting of objects. And in general I don't think you want to do that. Void pointers should be cast to other types as necessary; having them default to another variable type can be very dangerous.

    Regards,

    Matt P.

  3. #3
    Regular Contributor
    Join Date
    May 2003
    Posts
    96

    Re: CodeWarrior compiler customization?

    Hi,

    thank you for your suggestion.

    BTW, IMHO sometime you may want to avoid explicit casting... I recognize that is a _BAD_ habbit, but when you have to import a lot of C code (where it is allowed) and compile it with a C++ compiler (which wants explicit casting) it may save a lot of work.
    However the best solution for this specific problem is probably threat .c files as such, and not compiling them as .cpp

    Thanks,
    mik

  4. #4
    Registered User
    Join Date
    Nov 2006
    Posts
    31

    Re: CodeWarrior compiler customization?

    Hi - I'm having the same problem - "invalid conversion from" when implicitly casting to/from a void *.

    Thing is - my source code file is a .c file, not a .cpp file. Why am I having this problem?

    Simon

  5. #5
    Registered User
    Join Date
    Nov 2006
    Posts
    31

    Re: CodeWarrior compiler customization?

    ok - here's a little more info on the problem. I'm building from within Carbide.c++, the command line shown in the "Properties" box for the file gives these options:

    mwccsym2.exe -sym full -c -wchar_t off -align 4 -enum int -str pool -nostdinc -exc ms -inline off -msgstyle parseable -nowraplines -O0 -D_UNICODE -DDEVICE_ID=8 -D__SYMBIAN32__ -D__CW32__ -D__WINS__ -D__EXE__ -D__WINSCW__ -D_DEBUG -D__SUPPORT_CPP_EXCEPTIONS__ -D__SERIES60_31__ -D__SERIES60_3X__ -include"C:\Symbian\9.2\S60_3rd_FP1\epoc32\include\variant\Symbian_OS_v9.2.hrh" -i- -w cmdline -w pragmas -w empty -w possible -w unusedarg -w unusedvar -w extracomma -w pedantic -w largeargs -w ptrintconv -w tokenpasting -w missingreturn

Similar Threads

  1. Replies: 4
    Last Post: 2004-03-19, 07:28
  2. Filtered TextListBox customization
    By botvinik in forum Symbian
    Replies: 0
    Last Post: 2002-12-12, 08:23

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×