Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#pragma once does not work if files referenced by alternate paths #714

Closed
mmastrac opened this issue Jun 29, 2021 · 3 comments
Closed

#pragma once does not work if files referenced by alternate paths #714

mmastrac opened this issue Jun 29, 2021 · 3 comments
Labels

Comments

@mmastrac
Copy link

mmastrac commented Jun 29, 2021

Repro attached.

test.c:

#include "base.h"
#include "x/inc.h"

base.h:

#pragma once
struct foo {
        int bar;
};

x/inc.h

#pragma once
#include "../base.h"

Using 2021-05-01 build.

Expected result: successful compile (works in gcc/llvm)
Actual result: /home/x/../base.h(3): Error! E1019: Tag 'foo' already defined
Workaround: #ifdef guards

repro.zip

@jmalak jmalak added the bug label Jun 29, 2021
@jmalak
Copy link
Member

jmalak commented Jun 29, 2021

Thanks for bug report.
I confirm this bug in both C and C++ compilers.

@jmalak
Copy link
Member

jmalak commented Aug 12, 2021

It is standard OW behaviour for any version to use specified name(in source file) instead of OS fullpath.
I will change behaviour to use OS fullpath for comparision then it should work as expected.
The problem is common for similar pragmas which works with path or file name that they must be fixed too.

@jmalak
Copy link
Member

jmalak commented Aug 14, 2021

Now it should be fixed in git repository.

@jmalak jmalak closed this as completed Sep 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants