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

Suggest that iargc and getarg be replaced by command_argument_count and get_command_argument #267

Open
Beliavsky opened this issue Jan 9, 2025 · 4 comments
Labels
good first issue Good for newcomers rule A new rule for the linter

Comments

@Beliavsky
Copy link

Beliavsky commented Jan 9, 2025

For a code such as

PROGRAM test_getarg
  implicit none
  INTEGER :: i
  CHARACTER(len=32) :: arg
  DO i = 1, iargc()
    CALL getarg(i, arg)
    WRITE (*,*) arg
  END DO
END PROGRAM test_getarg

from the gfortran documentation, Fortitude could suggest that iargc and getarg be replaced by command_argument_count and get_command_argument.

@Beliavsky Beliavsky changed the title Suggest that getarg and iargc be replaced by command_argument_count and get_command_argument Suggest that iargc and getarg be replaced by command_argument_count and get_command_argument Jan 9, 2025
@ZedThree ZedThree added the rule A new rule for the linter label Jan 9, 2025
@LiamPattinson LiamPattinson added the good first issue Good for newcomers label Jan 9, 2025
@ZedThree
Copy link
Member

ZedThree commented Jan 9, 2025

There's also similar functions in other compilers that could be replaced.

This feels like a new category, something like Portability or Standard?

@LiamPattinson
Copy link
Collaborator

This should be quite nice to implement, and I imagine auto-fixes would be fairly easy (at least for the GNU functions, I can't speak for the other compiler-specific functions).

@ZedThree I'm torn, as I think Portability is the better category name but Standard would allow rule codes to have the form STD001. Maybe the latter? I was just thinking Style for this one, but I think you're right that a new category would make sense here.

@ZedThree
Copy link
Member

ZedThree commented Jan 9, 2025

There's lots of other compiler extensions that could go in this category, e.g. abort.

Yes, maybe Standard and STD

@imciner2
Copy link
Contributor

imciner2 commented Jan 9, 2025

I had actually been thinking about a Portability category that would have rules for the various non-portable things, it is just going to be a pain to gather a list of all the non-portable things. I found where the gfortran source code defines their intrinsics, but I haven't found good lists for other compilers. I would actually fold the integer(4) type of rule into this category as well.

I also was thinking about rules for standards-compliance, where you could say you wanted code that was compliant with Fortran 2008, and then rules could identify the use of things from future standards (for instance, using intrinsics that were added in 2018/2023).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers rule A new rule for the linter
Projects
None yet
Development

No branches or pull requests

4 participants