C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 팁&트릭
C++Builder Programming Tip&Tricks
[580] 빌더 컴파일러 커맨드라인 옵션과 #pragma로 warn 수동 제어하기.
김태선 [jsdkts] 19100 읽음    2006-03-04 19:14
아래는 커맨드라인 옵션리스트와 그 설명입니다.

이 중에서 warning 경고 메시지 제어는 -w 로 시작하는 항목입니다.

가령 변수를 사용하지 않는다는 경고 메시지를 아래에서 찾아 보면 같습니다.
-w-aus    -w-8004    'identifier' is assigned a value that is never used (Default ON)
이를 프로그램의 소스에서 적용하려면
#pragma warn -aus
이렇게 해주면 됩니다.
다른 것도 비슷한데... 다 그렇다고는 보장 못합니다 (이 부분 지송 --;)

하나 더 예를 들어 보면,
C 로 짜여진 프로그램 옮길때 종종 만나게 되는
Call to function 'function' with no prototype
경고를 잠재워 보겠습니다.
같은 뜻의 항목을 찾아보면 아래와 같습니다.
-w-pro    -w-8064    Call to function 'function' with no prototype (Default ON)
그러므로
#pragma warn -pro
이렇게 해주면 됩니다.

또 하나만 더 예를 들면
Code has no effect
경고 메시지를 아래에서 찾으면
-w-eff    -w-8019    Code has no effect (Default ON)
이렇고, 이는 당연히
#pragma warn -eff
로 잠재울 수 있습니다.

그럼.....





Compiler options (alphabetical listing)

The following table is an alphabetical listing of the C++Builder compiler options:

Option    Description

@<filename>    Read compiler options from the response file filename
+<filename>    Use alternate compiler configuration file filename
-3    Generate 80386 protected-mode compatible instructions (Default)
-4    Generate 80386/80486 protected-mode compatible instructions
-5    Generate Pentium instructions

-6    Generate Pentium Pro instructions
-A    Use ANSI keywords and extensions
-AK    Use Kernighan and Ritchie keywords and extensions
-AT    Use Borland C++ keywords and extensions (also -A-)
-AU    Use UNIX V keywords and extensions
-a    Default (-a8) data alignment; -a- is byte alignment (-a1)
-an    Align data on "n" boundaries, where 1=byte, 2=word (2 bytes), 4=double word (4 bytes), 8=quad word (8 bytes), 16=paragraph (16 bytes) (Default: -a8)

-B    Compile to .ASM (-S), then assemble to .OBJ
-b    Make enums always integer-sized (Default: -b makes enums integer size)
-b-    Makes enums byte-sized when possible
-C    Turn nested comments on (Default: -C- turn nested comments off)
-CP    Enable code paging (for MBCS)
-c    Compile to .OBJ, no link
-D<name>    Define "name" to the null string
-D<name=string>    Define "name" to "string"

-d    Merge duplicate strings
-d-    Does not merge duplicate strings (Default)
-E<filename>    Specify assembler
-e<filename>    Specify executable file name
-f    Emulate floating point
-f-    No floating point
-ff    Fast floating point
-fp    Correct Pentium FDIV flaw
-gb    Stop batch compilation after first file with warnings (Default = OFF)
-gn    Warnings: stop after n messages (Default = 255)

-G, -G-    Optimize for size/speed; use ?O1 and 뻆2 instead
-H    Generate and use precompiled headers
-H-    Does not generate or use precompiled headers (Default)
-H=<filename>    Set the name of the file for precompiled headers
-H"xxx"    Stop precompiling after header file xxx
-Hc    Cache precompiled header (Must be used with -H or -H"xxx"

-He    Enable precompiled headers with external type files (Default)
-Hh=xxx    Stop precompiling after header file xxx
-Hs    Enable smart cached precompiled headers (Default)
-Hu    Use but do not generate precompiled headers
-I<path>    Include file search path
-in    Make significant identifier length to be n (Default = 250)
-Ja    Expand all template members (including unused members)

-jb    Stop batch compilation after first file with errors (Default = OFF)
-Jgd    Generate definitions for all template instances and merge duplicates (Default)
-Jgx    Generate external references for all template instances
-jn    Errors: stop after n messages (Default = 25)
-K    Default character type unsigned (Default: -K- default character type signed)
-k    Turn on standard stack frame (Default)

-L<path>    Library file search path
-lx    Pass option x to linker
-l-x    Disables option x for the linker
-M    Create a Map file
-n<path>    Sets output directory to path
-O    Optimize jumps
-O1    Generate smallest possible code
-O2    Generate fastest possible code
-Oc    Eliminate duplicate expressions within basic blocks and functions

-Od    Disable all optimizations
-Oi    Expand common intrinsic functions
-OS    Pentium instruction scheduling
-O-S    Disables instruction scheduling
-Og    Optimize for speed; use 뻆2 instead
-Os    Optimize for speed; use 뻆2 instead
-Ot    Optimize for size; use 뻆1 instead
-Ov    Enable loop induction variable and strength reduction

-Ox    Optimize for speed; use 뻆2 instead
-o<filename>    Compile .OBJ to filename
-P    Perform C++ compile regardless of source extension
-P-    Perform C++ compile depending on source file extension
-P<ext>    Perform C++ compile, set output to extension to .ext
-p    Use Pascal calling convention
-p-    Use C calling convention
-pc    Use C calling convention (Default: -pc, -p-)

-pm    Functions without an explicit calling convention to use __msfastcall.
-pr    Use fastcall calling convention for passing parameters in registers
-ps    Use stdcall calling convention
-Q    Extended compiler error information(Default = OFF)
-q    Suppress compiler identification banner (Default = OFF)
-R    Include browser information in generated .OBJ files

-RT    Enable runtime type information (Default)
-r    Use register variables (Default)
-r-    Disable the use of register variables
-rd    Use register variables only when register keyword is employed
-S    Compile to assembler
-T-    Removes all assembler options
-Tx    Specify assembler option x
-tW    Target is a Windows application (same as -W)

-tWC    Target is a console application (same as -WC)
-tWD    Generate a .DLL executable (same as -WD)
-tWM    Generate a 32-bit multi-threaded target (same as -WM)
-tWR    Target uses the dynamic RTL (same as -WR)
-tWV    Target uses the VCL
-U<name>    Undefine any previous definitions of name
-u    Generate underscores (Default)
-V    Use smart C++ virtual tables (Default)

-V0    External C++ virtual tables
-V1    Public C++ virtual tables
-VC    Calling convention mangling compatibility
-Vd    for loop variable scoping
-Ve    Zero-length empty base classes
-VM    Microsoft Visual C++ compatibility
-VI-    Use old Borland search algorithm to locate header files (look first in current working directory)
-Vl    Use old-style Borland C++ structure layout (for compatibility with older versions of BCC32.EXE)

-VF    MFC compatibility
-Vmd    Use the smallest possible representation for member pointers
-Vmm    Support multiple inheritance for member pointers
-Vmp    Honor declared precision of member pointers
-Vms    Support single inheritance for member pointers
-Vmv    Place no restrictions on where member pointers can point (Default)
-Vx    Zero-length empty class member functions

-v    Turn on source debugging
-vG    All Codeguard options on
-vGc    Inline pointer access (Codeguard)
-vGd    Global and stack data accesses (Codeguard)
-vGt    this pointer on member function entry (Codeguard)
-vi    Control expansion of inline functions

-W    Target is a Windows application (same as -tW)
-WC    Target is a console application (same as -tWC)
-WD    Generate a .DLL executable (same as -tWD)
-WM    Generate a 32-bit multi-threaded target (same as -tWM)
-WR    Target uses the dynamic RTL (same as -tWR)
-WU    Generates Unicode application
-w    Display warnings on
-w!    Returns non-zero from compiler on warnings

-wxxx    Enable xxx warning message
-w-xxx    Disable xxx warning message
-wmsg    User-defined warnings
-X    Disable compiler autodependency output (Default: -X- use compiler autodependency output)
-x    Enable exception handling (Default)
-xd    Enable destructor cleanup (Default)
-xdg    Use global destructor count (for compatibility with older versions of BCC32.EXE)

-xf    Enable fast exception prologs
-xp    Enable exception location information
-xs    Enable slow exception epilogs
-xv    Causes the compiler to hide special exception handling variables so variables of this name can be used.
-y    Puts debug line numbers on

Message options (alphabetical listing)

Option    Number (Alias)    Warning Message

-w-ali    -w-8086    Incorrect use of #pragma alias 밶liasName?= 뱒ubstitutename?(Default ON)
-wamb    -w8000    Ambiguous operators need parentheses (Default OFF)
-wamp    -w8001    Superfluous & with function (Default OFF)
-w-asc    -w-8002    Restarting compile using assembly (Default ON)
-wasm    -w8003    Unknown assembler instruction (Default OFF)
-w-aus    -w-8004    'identifier' is assigned a value that is never used (Default ON)

-wbbf    -w8005    Bit fields must be signed or unsigned int (Default OFF)
-w-bei    -w-8006    Initializing 'identifier' with 'identifier' (Default ON)
-w-big    -w-8007    Hexadecimal value contains more than three digits (Default ON)
-w-ccc    -w-8008    Condition is always true OR Condition is always false (Default ON)
-wcln    -w8009    Constant is long (Default OFF)
-w-cod    -w-8093    Incorrect use of #pragma codeseg (Default ON)

-w-com    -w-8010    Continuation character \ found in // comment (Default ON)
-w-cpt    -w-8011    Nonportable pointer comparison (Default ON)
-w-csu    -w-8012    Comparing signed and unsigned values (Default ON)
-wdef    -w8013    Possible use of 'identifier' before definition (Default OFF)
-w-dig    -w-8014    Declaration ignored (Default ON)
-w-dpu    -w-8015    Declare 'type' prior to use in prototype (Default ON)

-w-dsz    -w-8016    Array size for 'delete' ignored (Default ON)
-w-dup    -w-8017    Redefinition of 'macro' is not identical (Default ON)
-w-eas    -w-8018    Assigning 몋ype?to 멷num?(Default ON)
-w-eff    -w-8019    Code has no effect (Default ON)
-w-ext    -w-8020    'identifier' is declared as both external and static (Default ON)
-w-hch    -w-8021    Handler for 'type1' Hidden by Previous Handler for 'type2' (Default ON)

-w-hid    -w-8022    'function1' hides virtual function 'function2' (Default ON)
-w-ias    -w-8023    Array variable 'identifier' is near (Default ON)
-w-ibc    -w-8024    Base class 'class1' is also a base class of 'class2' (Default ON)
-w-ifr    -w-8085    Function 'function' redefined as non-inline (Default ON)
-w-ill    -w-8025    Ill-formed pragma (Default ON)
-w-inl    -w-8026    Functions containing certain constructs are not expanded inline (Default ON)

-w-inl    -w-8027    Functions containing reserved words are not expanded inline (Default ON)
-w-lin    -w-8028    Temporary used to initialize 'identifier' (Default ON)
-w-lvc    -w-8029    Temporary used for parameter 'parameter' (Default ON)
-w-lvc    -w-8030    Temporary used for parameter 'parameter' in call to 'function' (Default ON)
-w-lvc    -w-8031    Temporary used for parameter number (Default ON)

-w-lvc    -w-8032    Temporary used for parameter number in call to 'function' (Default ON)
-w-mcs    -w-8096    Incorrect use of #pragma code_seg (Default ON)
-w-mes    -w-8095    Incorrect use of #pragma message (Default ON)
-w-mpc    -w-8033    Conversion to 몋ype?fails for members of virtual base 멳ase?(Default ON)
-w-mpd    -w-8034    Maximum precision used for member pointer type 몋ype?(Default ON)

-w-msg    -w-8035    User-defined warnings (Default ON)
-wnak    -w8036    Non-ANSI Keyword Used: 'keyword' (Default OFF)
(Note: Use of this option is required for ANSI conformance)
-w-ncf    -w-8037    Non-const function 멹unction?called for const object (Default ON)
-w-nci    -w-8038    Constant member 'identifier' is not initialized (Default ON)
-w-ncl    -w-8039    Constructor initializer list ignored (Default ON)

-w-nfd    -w-8040    Function body ignored (Default ON)
-w-ngu    -w-8041    Negating unsigned value (Default ON)
-w-nin    -w-8042    Initializer for object 'identifier' ignored (Default ON)
-w-nma    -w-8043    Macro definition ignored (Default ON)
-w-nmu    -w-8044    #undef directive ignored (Default ON)
-wnod    -w8045    No declaration for function 'function' (Default OFF)
-w-nop    -w-8046    Pragma option pop with no matching option push (Default ON)

-w-npp    -w-8083    Pragma pack pop with no matching pack push (Default ON)
-w-nsf    -w-8047    Declaration of static function 'function(...)' ignored (Default ON)
-w-nst    -w-8048    Use qualified name to access nested type 'type' (Default ON)
-w-ntd    -w-8049    Use '> >' for nested templates instead of '>>' (Default ON)
-w-nto    -w-8050    No type OBJ file present. Disabling external types option. (Default ON)

-w-nvf    -w-8051    Non-volatile function 멹unction?called for volatile object (Default ON)
-w-obi    -w-8052    Base initialization without a class name is now obsolete (Default ON)
-w-obs    -w-8053    'identifier' is obsolete (Default ON)
-w-ofp    -w-8054    Style of function definition is now obsolete (Default ON)
-w-onr    -w-8097    Not all options can be restored at this time (Default ON)

-w-osh    -w-8055    Possible overflow in shift operation (Default ON)
-w-ovf    -w-8056    Integer arithmetic overflow (Default ON)
-w-par    -w-8057    Parameter 'parameter' is never used (Default ON)
-w-pch    -w-8058    Cannot create pre-compiled header: 멻eader?(Default ON)
-w-pck    -w-8059    Structure packing size has changed (Default ON)
-w-pcm    -w-8094    Incorrect use of #pragma comment (Default ON)

-w-pia    -w-8060    Possibly incorrect assignment (Default ON)
-wpin    -w8061    Initialization is only partially bracketed (Default OFF)
-w-pow    -w-8062    Previous options and warnings not restored (Default ON)
-w-prc    -w-8084    Suggest parentheses to clarify precedence (Default OFF)
-w-pre    -w-8063    Overloaded prefix operator 'operator' used as a postfix operator (Default ON)
-w-pro    -w-8064    Call to function 'function' with no prototype (Default ON)

-w-pro    -w-8065    Call to function 'function' with no prototype (Default ON)
-w-rch    -w-8066    Unreachable code (Default ON)
-w-ret    -w-8067    Both return and return of a value used (Default ON)
-w-rng    -w-8068    Constant out of range in comparison (Default ON)
-w-rpt    -w-8069    Nonportable pointer conversion (Default ON)
-w-rvl    -w-8070    Function should return a value (Default ON)

-wsig    -w8071    Conversion may lose significant digits (Default OFF)
-w-spa    -w-8072    Suspicious pointer arithmetic (Default ON)
-w-stl    -w-8087    몂perator==?must be publicly visible to be contained by a 몁ame?(Default OFF)
-w-stl    -w-8089    몂perator<?must be publicly visible to be contained by a 몁ame?(Default OFF)
-w-stl    -w-8090    몂perator<?must be publicly visible to be used by a 몁ame?(Default OFF)

-w-stl    -w-8091    몋ype?argument 멲rgument?passed to 멹unction?is a 몋ype?iterator. 몋ype?iterator required (Default OFF)
-w-stl    -w-8092    몋ype?argument 멲rgument?passed to 멹unction?is not an iterator. 몋ype?iterator required (Default OFF)

-wstu    -w8073    Undefined structure 'structure' (Default OFF)
-wstv    -w8074    Structure passed by value (Default OFF)
-w-sus    -w-8075    Suspicious pointer conversion (Default ON)
-w-tai    -w-8076    Template instance 'instance' is already instantiated (Default ON)
-w-tes    -w-8077    Explicitly specializing an explicitly specialized class member makes no sense (Default ON)
-w-thr    -w-8078    Throw expression violates exception specification (Default ON)

-wucp    -w8079    Mixing pointers to different 'char' types (Default OFF)
-wuse    -w8080    'identifier' declared but never used (Default OFF)
-w-voi    -w-8081    void functions may not return a value (Default ON)
-w-zdi    -w-8082    Division by zero (Default ON)

+ -

관련 글 리스트
580 빌더 컴파일러 커맨드라인 옵션과 #pragma로 warn 수동 제어하기. 김태선 19100 2006/03/04
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.