I have used ClearCase for 20 years and this is the a crazy problem. I have encountered it with another compiler 8 years ago but this time I have no work-around.
FileA includes HeaderX and HeaderY but the precompiler never reads HeaderY which has nothing to do with HeaderX (take HeaderX out of the equation or make relatively arbitrary changes to HeaderX and HeaderY is read)
Randomly, we are seeing the old powerpc-wrs-vxworks gcc-2.96 compiler not include files during precompilation. This only happens in a particular vob and only happens in dynamic views and occurs randomly. We believe that this is specific to this particular VOB and believe that there is something wrong with the VOB. We have experienced the problem with Win7 ClearCase version 7.1.2.1, but also with WinXP. Over the years, we have noticed a similar problem with this VOB with another compiler. When we traced the compiler, we see that it opens and fstat's the include file and then closes without a read. Normally, the compiler will perform a read after the open. The trace shows the fstat returning a valid size. Below is the simplest distillation of the problem but do not be lured into thinking it is something about the contents of the file for an explanation of the behavior - you can make arbitrary changes to the files to elicit the correct behavior. Specifically, you can use identical files moved to a different location in the same view or outside the view and the compiler will behave correctly or use a different view with the same files and it will work. We believe, some interaction with MVFS, specific to this VOB, and the compiler is the problem.
Has anyone seen a state that a malfunctioning VOB could get into that may exhibit this misbehavior randomly in views?
foo.c:
#include "HeaderX.h" /* fix 1 remove this line
fix 2 rename this include file
fix 3 move this include file to a new dir */
#include "HeaderY.h" /* fix 4 move this line up
fix 5 rename this include file
fix 6 move this include file to a new dir */
HeaderX.h:
/* a=b; fix 7 uncomment this line */
#ifndef X /* fix 8 change this to an #ifdef instead of #ifndif */
#define X /* fix 9 remove this line
fix 10 change just this X to Y
fix 11 move define after endif */
#endif
HeaderY.h:
#error hurrah! I was included /* GOAL -- to have this file included
If it is included the precompiler
will print this message.
*/
P.S Don't tell me it is a compiler bug.
Reasons to believe it is a ClearCase issue:
- Only happens in dynamic views
- Happens on multiple machines, multiple users, multiple views, different operating systems. But it is somewhat random.
Reasons to doubt my reasons:
- Fixes 7, 8, 9, 10, 11
- In cases where it fails, using a different version of the compiler will not cause the error.
- But I think questioning the compiler is a red herring, the same compiler with the same set of files will work fine outside of ClearCase or in a different directory in the same view. The VOB is about 15 years old and I think it is peculiar to the VOB. But it is a huge effort to replace it.