2008-10-05 8 views
13

최근에 필자의 gcc 컴파일 옵션에 -pedantic 및 -pedantic-errors를 추가하여 제 크로스 플랫폼 코드를 정리하는 데 도움이되었습니다. 모두 외부에서 포함 된 헤더 파일에서 오류를 찾을 때까지 괜찮 았습니다. 외부 헤더에이 오류 점검을 해제 할 수있는 방법은 IE이 파일은 다음과 같다 : 파일을 검사외부 라이브러리 헤더에서 gcc 컴파일러 패닉 오류를 무시하는 방법?

보관할 것 같이 포함 :

#include "myheader.h" 

중지에 대한 검사는 다음과 같은 파일을 포함 :

#include <externalheader.h> 

다음은 내가 받고있는 오류입니다.

g++ -Wall -Wextra -Wno-long-long -Wno-unused-parameter -pedantic --pedantic-errors 
-O3 -D_FILE_OFFSET_BITS=64 -DMINGW -I"freetype/include" -I"jpeg" -I"lpng128" -I"zlib" 
-I"mysql/include" -I"ffmpeg/libswscale" -I"ffmpeg/libavformat" -I"ffmpeg/libavcodec" 
-I"ffmpeg/libavutil" -o omingwd/kguimovie.o -c kguimovie.cpp 

In file included from ffmpeg/libavutil/avutil.h:41, 
      from ffmpeg/libavcodec/avcodec.h:30, 
      from kguimovie.cpp:44: 
ffmpeg/libavutil/mathematics.h:32: error: comma at end of enumerator list 
In file included from ffmpeg/libavcodec/avcodec.h:30, 
      from kguimovie.cpp:44: 
ffmpeg/libavutil/avutil.h:110: error: comma at end of enumerator list 
In file included from kguimovie.cpp:44: 
ffmpeg/libavcodec/avcodec.h:277: error: comma at end of enumerator list 
ffmpeg/libavcodec/avcodec.h:303: error: comma at end of enumerator list 
ffmpeg/libavcodec/avcodec.h:334: error: comma at end of enumerator list 
ffmpeg/libavcodec/avcodec.h:345: error: comma at end of enumerator list 
ffmpeg/libavcodec/avcodec.h:2249: warning: `ImgReSampleContext' is deprecated 
(declared at ffmpeg/libavcodec/avcodec.h:2243) 
ffmpeg/libavcodec/avcodec.h:2259: warning: `ImgReSampleContext' is deprecated 
(declared at ffmpeg/libavcodec/avcodec.h:2243) 
In file included from kguimovie.cpp:45: 
ffmpeg/libavformat/avformat.h:262: error: comma at end of enumerator list 
In file included from ffmpeg/libavformat/rtsp.h:26, 
      from ffmpeg/libavformat/avformat.h:465, 
      from kguimovie.cpp:45: 
ffmpeg/libavformat/rtspcodes.h:38: error: comma at end of enumerator list 
In file included from ffmpeg/libavformat/avformat.h:465, 
      from kguimovie.cpp:45: 
ffmpeg/libavformat/rtsp.h:32: error: comma at end of enumerator list 
ffmpeg/libavformat/rtsp.h:69: error: comma at end of enumerator list 

답변

-3

헤더를 수정하고 ffmpeg에 패치를 제출할 수 있습니다. -pedantic과의 호환성은 가치있는 목표이므로, 특히 후속 쉼표 등을 제거하는 것과 관련하여 고려해 볼 것이라고 확신합니다.

+10

이것은 실제로 질문에 대답하지 않습니다. – Nick

+1

@KPexEA : 동의를 재 할당하여 분명한 더 나은 대답을 생각해보십시오. SO 검색 결과와 인간 독자가 대답을 찾을 수 있도록 도와주십시오. – sehe

0

내 생각에는 하나의 아이디어가 있습니다. 'out of the box'매개 변수가 있는지 확인하십시오.

컴파일러의 출력을 가져올 스크립트를 준비하고 특정 목록에없는 헤더를 포함하는 모든 행을 제거하십시오 ( 헤더).

이렇게하면 안됩니다.

29

-Wsystem-headers 옵션을 gcc와 함께 사용하면 일반적으로 표시되지 않는 시스템 헤더와 관련된 경고 메시지가 인쇄됩니다. 그러나 gcc가 기본적으로이 파일을 시스템 헤더로 처리하도록하고 있으므로 "-isystem/usr/local/ffmpeg"(또는 그 패키지를 설치 한 곳)에 전달하여 gcc가 포함 된 파일의 오류를 무시하도록 할 수 있습니다 이 디렉토리들도 마찬가지입니다.

+0

위대한! 그 대답은 받아 들여 져야만했습니다! –

1

gcc에 경고를 표시하지 말 것을 알리는 방법이 없습니다. 그러나 llvm-gcc (또는 단지 gcc)와 같은 제 3 자 경고를 hackishly 제거 할 수 있습니다. -pedantic 2>1 | grep -v "/ usr /"

-2

GCC에 대해 헤더와 다른 사람이 없습니다. 비록 그것이 이상적으로 모든 사람이 현학적 일지 모른다고해서 저항을받을 것이라고 생각할지라도, 그것을 기능으로 제안 할 수 있습니다.

할 수있는 것은 헤더를 직접 수정하고 패치를 만든 다음 라이브러리를 업그레이드하면 이후 버전의 헤더에 적용하는 것입니다.

ffmpeg에 패치를 적용 할 것을 희망하지만, 패치를 수락하지 않더라도 덮어 씌우는 방법으로 패치를 제출하십시오.

+0

ffmpeg 헤더는 -pedantic -std = c99와 함께 유효하며 빌드하는 데 사용됩니다. 하지만 공개 헤더는 무엇이든간에 유효해야합니다. extern "C"역시 ... –