Skip to content

[flang] Implement external routine usage of hostnm() #134900

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

Merged
merged 14 commits into from
Apr 15, 2025

Conversation

eugeneepshteyn
Copy link
Contributor

@eugeneepshteyn eugeneepshteyn commented Apr 8, 2025

Previously, hostnm extended intrinsic was implemented as proper intrinsic. Since then we found out that some applications use hostnm as external routine via external hostnm. This prevents hostnm from being recognized as an intrinsic. This PR implements hostnm as external routine.

	modified:   flang-rt/lib/runtime/extensions.cpp
	modified:   flang-rt/lib/runtime/extensions.cpp
	modified:   flang/include/flang/Runtime/extensions.h
@llvmbot llvmbot added the flang Flang issues not falling into any other category label Apr 8, 2025
Copy link

github-actions bot commented Apr 8, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@@ -264,6 +264,43 @@ int RTNAME(Chdir)(const char *name) {
#endif
}

int FORTRAN_PROCEDURE_NAME(hostnm)(char *hn, int length) {

Copy link
Contributor

Choose a reason for hiding this comment

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

This would be a lot easier to read if it wasn't so needlessly stretched out vertically by all these blank lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed some blank lines.

if (status == 0) {
// Find zero terminator and fill the string from the
// zero terminator to the end with spaces
char *str_end = hn + length;
Copy link
Contributor

Choose a reason for hiding this comment

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

Always use braced initialization in the runtime and other modern C++ directories, please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@eugeneepshteyn eugeneepshteyn requested a review from klausler April 15, 2025 21:07
@eugeneepshteyn eugeneepshteyn merged commit 3428cc9 into llvm:main Apr 15, 2025
6 of 9 checks passed
@eugeneepshteyn eugeneepshteyn deleted the hostnm-c branch April 15, 2025 23:05
var-const pushed a commit to ldionne/llvm-project that referenced this pull request Apr 17, 2025
Previously, `hostnm` extended intrinsic was implemented as proper
intrinsic. Since then we found out that some applications use `hostnm`
as external routine via `external hostnm`. This prevents `hostnm` from
being recognized as an intrinsic. This PR implements `hostnm` as
external routine.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants