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

Fix: インクルードガードの前の空行やコメント行を許容するようにしました #410

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

granddaifuku
Copy link
Contributor

@granddaifuku granddaifuku commented Nov 2, 2022

#219 に対応しています

  • 修正に伴って、元のエラーメッセージを、include guardの外側にコードが書かれていた場合を参考に変更しましたのでそちらもお時間あればご確認お願いします。

@granddaifuku
Copy link
Contributor Author

本件とは少し話が逸れますが、CIが Python の Setup で落ちているので、それを先に修正する必要がありそうです。

Copy link
Contributor

@kzrnm kzrnm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こちらのリポジトリは事実上メンテナンスされてないようなので、自作の移植・改良版を作成したのですが、この issue を移植する 作業で気付いたことがあるので一応コメントしておきます。

https://github.com/competitive-verifier/competitive-verifier より

Comment on lines 348 to +353
if uncommented_line:
non_guard_line_found = True
if not non_guard_line_found and uncommented_line == b"\n":
# include guard の前がコメントまたは空行の場合は non_guard_line_found を True にしない
pass
else:
non_guard_line_found = True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if uncommented_line and not re.match(rb"^\s*$", uncommented_line): とすると

      // インデント付コメント
#pragma once

みたいなのも除外できるのでベターなのではないかと思います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants