Skip to content

[Runtime] Repair build of getenv mode in EnvironmentVariables.cpp #75669

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

Conversation

kateinoigakukun
Copy link
Member

@kateinoigakukun kateinoigakukun commented Aug 3, 2024

Follow-up fix to 4b3a197

The return tyep should be const char * not const char, and each line of xmacro does not have a semicolon, so we need it in the VARIABLE definition side.

/home/build-user/swift/include/swift/Runtime/../../../stdlib/public/runtime/EnvironmentVariables.def:25:1: error: cannot initialize a variable of type 'const char' with an rvalue of type 'char *'
   25 | VARIABLE(SWIFT_DEBUG_ENABLE_METADATA_ALLOCATION_ITERATION, bool, false,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   26 |          "Enable additional metadata allocation tracking for swift-inspect to "
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   27 |          "use.")
      |          ~~~~~~~
/home/build-user/swift/stdlib/public/runtime/EnvironmentVariables.cpp:250:16: note: expanded from macro 'VARIABLE'
  250 |     const char name##_string = getenv(#name);                                  \
      |                ^               ~~~~~~~~~~~~~
<scratch space>:42:1: note: expanded from here
   42 | SWIFT_DEBUG_ENABLE_METADATA_ALLOCATION_ITERATION_string
      | ^

https://ci.swift.org/job/oss-swift-pr-test-crosscompile-wasm-ubuntu-20_04/1285/console

@kateinoigakukun
Copy link
Member Author

@swift-ci test WebAssembly

@kateinoigakukun kateinoigakukun force-pushed the yt/fix-getenv-call-path branch from 2b997ad to 650e90a Compare August 3, 2024 08:37
@kateinoigakukun kateinoigakukun changed the title [Runtime] Fix getenv return type in EnvironmentVariables.cpp [Runtime] Repair build of getenv mode in EnvironmentVariables.cpp Aug 3, 2024
@kateinoigakukun
Copy link
Member Author

@swift-ci test WebAssembly

@kateinoigakukun
Copy link
Member Author

https://ci.swift.org/job/swift-PR-Linux-crosscompile-wasm/119/console

/home/build-user/swift/test/IRGen/yield_result.sil:106:12: error: CHECK: expected string not found in input
 // CHECK: [[VW_PTR:%.*]] = getelementptr inbounds ptr, ptr [[TYPE]], i64 -1
           ^
<stdin>:123:3: note: scanning from here
6: ; preds = %entry
  ^
<stdin>:123:3: note: with "TYPE" equal to "%T"
6: ; preds = %entry
  ^
<stdin>:124:2: note: possible intended match here
 %7 = getelementptr inbounds ptr, ptr %T, i32 -1
 ^
/home/build-user/swift/test/IRGen/yield_result.sil:129:12: error: CHECK: expected string not found in input
 // CHECK: [[FRAME:%.*]] = alloca [32 x i8]
           ^
<stdin>:144:17: note: scanning from here
 %2 = alloca i64, align 8
                ^
<stdin>:145:2: note: possible intended match here
 %3 = alloca [16 x i8], align 4
 ^

@kateinoigakukun
Copy link
Member Author

@swift-ci test WebAssembly

@kateinoigakukun
Copy link
Member Author

@swift-ci smoke test

@kateinoigakukun
Copy link
Member Author

@swift-ci test WebAssembly

@kateinoigakukun kateinoigakukun marked this pull request as ready for review August 4, 2024 03:49
@kateinoigakukun kateinoigakukun merged commit 4ef187b into swiftlang:main Aug 4, 2024
4 checks passed
Copy link
Contributor

@mikeash mikeash left a comment

Choose a reason for hiding this comment

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

Sorry about that, and thanks for the fix. How did that pass PR testing….

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.

2 participants