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

先頭に空行やコメント行がある場合とインクルードガードがこわれる #219

Open
rsk0315 opened this issue Apr 5, 2020 · 3 comments
Labels

Comments

@rsk0315
Copy link

rsk0315 commented Apr 5, 2020

#ifndef#pragma once の前に空行やコメント(Doxygen 関連など)があるとこわれちゃいます。

https://github.com/kmyk/online-judge-verify-helper/blob/e0f3c547985e791402a9d951ea56480cc97ea9a2/onlinejudge_verify/languages/cplusplus_bundle.py#L191
このへん?

@kmyk
Copy link
Member

kmyk commented Apr 5, 2020

これは修整されるべき

@kmyk
Copy link
Member

kmyk commented May 10, 2020

これを踏んでいて、修正がされていなかった(完)

— わく (@wakuwinmail) May 10, 2020

新被害者発生

@kmyk kmyk added bug Something isn't working difficulty:middle priority:high labels May 10, 2020
@kmyk
Copy link
Member

kmyk commented May 10, 2020

このあたり

# #pragma once
if re.match(rb'\s*#\s*pragma\s+once\s*', line): # #pragma once は comment 扱いで消されてしまう
logger.debug('%s: line %s: #pragma once', str(path), i + 1)
if non_guard_line_found:
# 先頭以外で #pragma once されてた場合は諦める
raise BundleError(path, i + 1, "#pragma once found in a non-first line")
if include_guard_macro is not None:
raise BundleError(path, i + 1, "#pragma once found in an include guard with #ifndef")
if path.resolve() in self.pragma_once:
return
pragma_once_found = True
self.pragma_once.add(path.resolve())
self._line(i + 2, path)
continue

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