[flang-commits] [flang] [flang] add no-cpp-dep test for AIX 64 bit (PR #74637)

via flang-commits flang-commits at lists.llvm.org
Wed Dec 20 04:42:28 PST 2023


https://github.com/madanial0 updated https://github.com/llvm/llvm-project/pull/74637

>From 4037ed0c1f90e267578a7cc832fac6cf028ab193 Mon Sep 17 00:00:00 2001
From: Mark Danial <madanial at dixon.rtp.raleigh.ibm.com>
Date: Wed, 6 Dec 2023 13:13:45 -0500
Subject: [PATCH 1/2] [flang] add no-cpp-dep test for AIX 64 bit

---
 flang/test/Runtime/no-cpp-dep-aix.c | 40 +++++++++++++++++++++++++++++
 flang/test/Runtime/no-cpp-dep.c     |  1 +
 2 files changed, 41 insertions(+)
 create mode 100644 flang/test/Runtime/no-cpp-dep-aix.c

diff --git a/flang/test/Runtime/no-cpp-dep-aix.c b/flang/test/Runtime/no-cpp-dep-aix.c
new file mode 100644
index 00000000000000..4d0591874dad03
--- /dev/null
+++ b/flang/test/Runtime/no-cpp-dep-aix.c
@@ -0,0 +1,40 @@
+/*
+This test makes sure that flang's runtime does not depend on the C++ runtime
+library. It tries to link this simple file against libFortranRuntime.a with
+a C compiler.
+
+REQUIRES: c-compiler, system-aix
+
+RUN: export OBJECT_MODE=64
+RUN: %cc -std=c99 %s -I%include %libruntime %libdecimal -lm -lpthread
+RUN: rm a.out
+*/
+
+#include "flang/Runtime/entry-names.h"
+#include <stdint.h>
+
+/*
+Manually add declarations for the runtime functions that we want to make sure
+we're testing. We can't include any headers directly since they likely contain
+C++ code that would explode here.
+*/
+struct EnvironmentDefaultList;
+struct Descriptor;
+
+double RTNAME(CpuTime)();
+
+void RTNAME(ProgramStart)(
+    int, const char *[], const char *[], const struct EnvironmentDefaultList *);
+int32_t RTNAME(ArgumentCount)();
+int32_t RTNAME(GetCommandArgument)(int32_t, const struct Descriptor *,
+    const struct Descriptor *, const struct Descriptor *);
+int32_t RTNAME(GetEnvVariable)();
+
+int main() {
+  double x = RTNAME(CpuTime)();
+  RTNAME(ProgramStart)(0, 0, 0, 0);
+  int32_t c = RTNAME(ArgumentCount)();
+  int32_t v = RTNAME(GetCommandArgument)(0, 0, 0, 0);
+  int32_t e = RTNAME(GetEnvVariable)("FOO", 0, 0);
+  return x + c + v + e;
+}
diff --git a/flang/test/Runtime/no-cpp-dep.c b/flang/test/Runtime/no-cpp-dep.c
index f8fe97b5bf78e2..e760c27d1f1564 100644
--- a/flang/test/Runtime/no-cpp-dep.c
+++ b/flang/test/Runtime/no-cpp-dep.c
@@ -4,6 +4,7 @@ library. It tries to link this simple file against libFortranRuntime.a with
 a C compiler.
 
 REQUIRES: c-compiler
+UNSUPPORTED: system-aix
 
 RUN: %cc -std=c99 %s -I%include %libruntime %libdecimal -lm -o /dev/null
 */

>From f06f12b028c5028f293743cb9e381bda6439bdfe Mon Sep 17 00:00:00 2001
From: Mark Danial <madanial at dixon.rtp.raleigh.ibm.com>
Date: Tue, 19 Dec 2023 22:05:56 -0500
Subject: [PATCH 2/2] Addressing Review Comments

---
 flang/test/Runtime/no-cpp-dep-aix.c | 40 -----------------------------
 flang/test/Runtime/no-cpp-dep.c     |  6 +++--
 2 files changed, 4 insertions(+), 42 deletions(-)
 delete mode 100644 flang/test/Runtime/no-cpp-dep-aix.c

diff --git a/flang/test/Runtime/no-cpp-dep-aix.c b/flang/test/Runtime/no-cpp-dep-aix.c
deleted file mode 100644
index 4d0591874dad03..00000000000000
--- a/flang/test/Runtime/no-cpp-dep-aix.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-This test makes sure that flang's runtime does not depend on the C++ runtime
-library. It tries to link this simple file against libFortranRuntime.a with
-a C compiler.
-
-REQUIRES: c-compiler, system-aix
-
-RUN: export OBJECT_MODE=64
-RUN: %cc -std=c99 %s -I%include %libruntime %libdecimal -lm -lpthread
-RUN: rm a.out
-*/
-
-#include "flang/Runtime/entry-names.h"
-#include <stdint.h>
-
-/*
-Manually add declarations for the runtime functions that we want to make sure
-we're testing. We can't include any headers directly since they likely contain
-C++ code that would explode here.
-*/
-struct EnvironmentDefaultList;
-struct Descriptor;
-
-double RTNAME(CpuTime)();
-
-void RTNAME(ProgramStart)(
-    int, const char *[], const char *[], const struct EnvironmentDefaultList *);
-int32_t RTNAME(ArgumentCount)();
-int32_t RTNAME(GetCommandArgument)(int32_t, const struct Descriptor *,
-    const struct Descriptor *, const struct Descriptor *);
-int32_t RTNAME(GetEnvVariable)();
-
-int main() {
-  double x = RTNAME(CpuTime)();
-  RTNAME(ProgramStart)(0, 0, 0, 0);
-  int32_t c = RTNAME(ArgumentCount)();
-  int32_t v = RTNAME(GetCommandArgument)(0, 0, 0, 0);
-  int32_t e = RTNAME(GetEnvVariable)("FOO", 0, 0);
-  return x + c + v + e;
-}
diff --git a/flang/test/Runtime/no-cpp-dep.c b/flang/test/Runtime/no-cpp-dep.c
index e760c27d1f1564..654bebed345b15 100644
--- a/flang/test/Runtime/no-cpp-dep.c
+++ b/flang/test/Runtime/no-cpp-dep.c
@@ -4,9 +4,11 @@ library. It tries to link this simple file against libFortranRuntime.a with
 a C compiler.
 
 REQUIRES: c-compiler
-UNSUPPORTED: system-aix
 
-RUN: %cc -std=c99 %s -I%include %libruntime %libdecimal -lm -o /dev/null
+RUN: %if system-aix %{ export OBJECT_MODE=64 %}
+RUN: %cc -std=c99 %s -I%include %libruntime %libdecimal -lm  \
+RUN: %if system-aix %{-lpthread %}
+RUN: rm a.out
 */
 
 #include "flang/Runtime/entry-names.h"



More information about the flang-commits mailing list