From d0c4cd8c7f3910411f8aa3c0a42ffcee3a92c52c Mon Sep 17 00:00:00 2001
From: Yang Kun <193369907+omikrun@users.noreply.github.com>
Date: Mon, 5 May 2025 20:04:19 +0800
Subject: [PATCH 1/2] More optimize options
---
cccl | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/cccl b/cccl
index e977449..21a3887 100755
--- a/cccl
+++ b/cccl
@@ -168,13 +168,29 @@ EOF
;;
-O0)
- clopt+=("${slash}Ot")
+ clopt+=("${slash}Od")
;;
-O2)
+ clopt+=("${slash}Ox")
+ ;;
+
+ -O3)
clopt+=("${slash}O2")
;;
+ -Ofast)
+ clopt+=("${slash}O2" "${slash}fp:fast")
+ ;;
+
+ -Os)
+ clopt+=("${slash}O1")
+ ;;
+
+ -Oz)
+ clopt+=("${slash}Os")
+ ;;
+
-L)
shift
path=`echo "$1"`
@@ -310,12 +326,7 @@ EOF
#ignore aliasing
;;
- -isystem)
- shift
- clopt+=("${slash}I$1")
- ;;
-
- -I)
+ -isystem | -I)
shift
clopt+=("${slash}I$1")
;;
@@ -351,7 +362,7 @@ EOF
fi
;;
- *.cc | *.cxx | *.C)
+ *.cc | *.cxx | *.C | *.c++)
# C++ source file with non .cpp extension, make sure cl understand
# that it is C++
clopt+=("${slash}Tp$1")
From 5f488c8b3446079516ae2acd7078d492c78974c2 Mon Sep 17 00:00:00 2001
From: Yang Kun <193369907+nukyan@users.noreply.github.com>
Date: Sat, 5 Jul 2025 08:45:03 +0800
Subject: [PATCH 2/2] Document -O2, -O3, -Ofast -Os and -Oz
---
README.markdown | 4 ++++
cccl | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/README.markdown b/README.markdown
index e17b218..e8ff8b3 100644
--- a/README.markdown
+++ b/README.markdown
@@ -422,6 +422,10 @@ The following Unix compiler cc/gcc options are understood by cccl:
- **-dumpversion** Version of cl.exe based on info in copyright banner
- **-g**[0-9] Converts to cl.exe's **/Zi**
- **-O0** Converts to cl.exe's **/Ot** optimization option
+ - **-O2** and **-O3** Converts to cl.exe's **/O2** optimization option
+ - **-Ofast** Converts to cl.exe's **/O2** and **/fp:fast** optimization option
+ - **-Os** Converts to cl.exe's **/O1** optimization option
+ - **-Oz** Converts to cl.exe's **/Os** optimization option
- **-Lpath** Converts to linker option **/LIBPATH:_path_**
- **-llibrary** Converts to **lib_library_.lib** (except **-link**)
- **-m386** Converts to cl.exe's **/G3**
diff --git a/cccl b/cccl
index 21a3887..4038046 100755
--- a/cccl
+++ b/cccl
@@ -168,11 +168,11 @@ EOF
;;
-O0)
- clopt+=("${slash}Od")
+ clopt+=("${slash}Ot")
;;
-O2)
- clopt+=("${slash}Ox")
+ clopt+=("${slash}O2")
;;
-O3)