Skip to content

common_args is not included in preprocessor caching #2038

@GZGavinZhao

Description

@GZGavinZhao

Repro file:

#include <bits/stdc++.h>

using namespace std;

int main()
{
#ifdef HELLO
	cout << "Hello World" << endl;
#else
	cout << "Hi World" << endl;
#endif
}

Run sccache gcc -c main.cpp -DHELLO. Then run sccache gcc -c main.cpp. You will see that the second command registers a cache hit when it clearly shouldn't.

This happens because as shown here, preprocessor_and_arch_args doesn't take common_args into account, and since -DHELLO belongs to common_args, removing it doesn't affect the hash of preprocessor_and_arch_args, hence registering a cache hit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions