문제

누구든지 경험이 있습니까? 부족한? 문서를 찾을 수없는 것 같아서 경고와 오류가 나에게 불분명합니다. 메일 링리스트와 맨 페이지를 확인하려고했지만 실제로는 많지 않습니다.

예를 들어 파일 중 하나에서 int_max를 사용합니다. #include limits.h에도 불구하고 오류 (정의되지 않은 식별자)가 생성됩니다.

오류와 경고가 설명 된 곳이 있습니까?

도움이 되었습니까?

해결책

스파 스는 말에 따라 보풀이 아닙니다. Sparse는 추가로 분석 할 수 있도록 임의 코드의 구문 분석 트리를 생성하기위한 것입니다.

당신의 예에서, 당신은 gnu_source (__gnuc__를 켜 있다고 믿는다)를 정의하려고합니다.

gnu_source가 정의되는 다른 모든 스위치없이 정의되지 않은 방식으로 활성화 될 수 있기 때문에 __gnuc__를 자체적으로 정의하지 않을 것입니다.

내 요점은 오류로 오류를 스쿼시하는 데 도움이되지 않습니다. 스파 스가 주로 독립형 정적 분석 도구가 아니라 라이브러리로 사용된다는 것을 반복하는 데 도움이됩니다.

내 readme 사본에서 (현재 버전이 있는지 확실하지 않음) :

This means that a user of the library will literally just need to do

  struct string_list *filelist = NULL;
  char *file;

  action(sparse_initialize(argc, argv, filelist));

  FOR_EACH_PTR_NOTAG(filelist, file) {
    action(sparse(file));
  } END_FOR_EACH_PTR_NOTAG(file);

and he is now done - having a full C parse of the file he opened.  The
library doesn't need any more setup, and once done does not impose any
more requirements.  The user is free to do whatever he wants with the
parse tree that got built up, and needs not worry about the library ever
again.  There is no extra state, there are no parser callbacks, there is
only the parse tree that is described by the header files. The action
function takes a pointer to a symbol_list and does whatever it likes with it.

The library also contains (as an example user) a few clients that do the
preprocessing, parsing and type evaluation and just print out the
results.  These clients were done to verify and debug the library, and
also as trivial examples of what you can do with the parse tree once it
is formed, so that users can see how the tree is organized.

포함 된 클라이언트는 무엇보다 '기능적 테스트 스위트와 예'입니다. 매우 유용한 도구이지만 사용하려면 다른 사용 각도를 고려할 수 있습니다. *Lex / Bison을 사용하지 않기 때문에 좋아하므로 해킹하기가 매우 쉽습니다.

다른 팁

한계를 보면 h int_max 가이 #if 내부에 정의되어 있음을 알 수 있습니다.

/* If we are not using GNU CC we have to define all the symbols ourself.
 Otherwise use gcc's definitions (see below).  */
#if !defined __GNUC__ || __GNUC__ < 2

따라서 작동하도록하려면 정의해야합니다 __GNUC__ 한계를 포함하기 전에 h

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top