Last active
June 24, 2018 02:22
-
-
Save Beliavsky/d37121a95f2fea77643e56798d86ad05 to your computer and use it in GitHub Desktop.
Python 2/3 script to list unused variables from gfortran compiler messages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 2018-06-23 | |
# list unused variable from gfortran output | |
# valid Python 2 and Python 3 | |
from sys import argv | |
compiler_message_file = argv[1] # produced by command such as gfortran 2> err_msg.txt -c -Werror=unused_variable source.f90 | |
fp = open(compiler_message_file,"r") | |
err_str = "Error: Unused variable" | |
print("unused variables:") | |
for line in fp: | |
text = line.strip() | |
if err_str in text: | |
print(text.strip(err_str).split()[0].strip("'")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment