[cfe-dev] Question about include stack printing on diagnostic notes

Argyrios Kyrtzidis akyrtzi at gmail.com
Tue Sep 6 20:55:43 PDT 2011


On Sep 6, 2011, at 7:20 PM, Chandler Carruth wrote:

> Not too long ago, Richard added an option to control whether we display include stacks on notes. Based on feedback from the community, the default of this option was made "off": we don't show include stacks for notes.
> 
> Would it be possible or desirable to remove this functionality completely? That is, does anyone see value in being able to enable these stacks under certain circumstances?

Here's an example where I'd like include stack on the note:

$ cat t.h
struct S {};

$ cat t2.h
#include "t.h"

$ cat t3.h
#include "t.h"

$ cat t.c
#include "t2.h"
#include "t3.h"

$ clang -cc1 t.c
In file included from t.c:2:
In file included from ./t3.h:1:
./t.h:1:8: error: redefinition of 'S'
struct S {};
       ^
./t.h:1:8: note: previous definition is here
struct S {};
       ^
1 error generated.

(No idea how that happened..)

$ clang -cc1 t.c -fdiagnostics-show-note-include-stack
In file included from t.c:2:
In file included from ./t3.h:1:
./t.h:1:8: error: redefinition of 'S'
struct S {};
       ^
In file included from t.c:1:
In file included from ./t2.h:1:
./t.h:1:8: note: previous definition is here
struct S {};
       ^
1 error generated.

(Eureka!)

> 
> I don't have a strong opinion here, although I always like deleting code. I'm just refactoring the text diagnostic emission and wanted to not spend time fixing rather than deleting unless this functionality is in active use.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev





More information about the cfe-dev mailing list