Mercurial > hg > nginx
annotate auto/cc/clang @ 7355:b64adc956643
Rewrite: removed r->err_status special handling (ticket #1634).
Trying to look into r->err_status in the "return" directive
makes it behave differently than real errors generated in other
parts of the code, and is an endless source of various problems.
This behaviour was introduced in 726:7b71936d5299 (0.4.4) with
the comment "fix: "return" always overrode "error_page" response code".
It is not clear if there were any real cases this was expected to fix,
but there are several cases which are broken due to this change, some
previously fixed (4147:7f64de1cc2c0).
In ticket #1634, the problem is that when r->err_status is set to
a non-special status code, it is not possible to return a response
by simply returning r->err_status. If this is the case, the only
option is to return script's e->status instead. An example
configuration:
location / {
error_page 404 =200 /err502;
return 404;
}
location = /err502 {
return 502;
}
After the change, such a configuration will properly return
standard 502 error, much like it happens when a 502 error is
generated by proxy_pass.
This also fixes the following configuration to properly close
connection as clearly requested by "return 444":
location / {
error_page 404 /close;
return 404;
}
location = /close {
return 444;
}
Previously, this required "error_page 404 = /close;" to work
as intended.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 21 Sep 2018 15:59:33 +0300 |
parents | ceab908790c4 |
children |
rev | line source |
---|---|
4762
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
1 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
2 # Copyright (C) Nginx, Inc. |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
3 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
4 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
5 # clang |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
6 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
7 |
7161
325b3042edd6
Configure: fixed clang detection on MINIX.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6603
diff
changeset
|
8 NGX_CLANG_VER=`$CC -v 2>&1 | grep 'version' 2>&1 \ |
7273
ceab908790c4
Configure: fixed clang version detection (closes #1539).
Ruslan Ermilov <ru@nginx.com>
parents:
7161
diff
changeset
|
9 | sed -n -e 's/^.*clang version \(.*\)/\1/p' \ |
ceab908790c4
Configure: fixed clang version detection (closes #1539).
Ruslan Ermilov <ru@nginx.com>
parents:
7161
diff
changeset
|
10 -e 's/^.*LLVM version \(.*\)/\1/p'` |
4762
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
11 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
12 echo " + clang version: $NGX_CLANG_VER" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
13 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
14 have=NGX_COMPILER value="\"clang $NGX_CLANG_VER\"" . auto/define |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
15 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
16 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
17 CC_TEST_FLAGS="-pipe" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
18 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
19 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
20 # optimizations |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
21 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
22 #NGX_CLANG_OPT="-O2" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
23 #NGX_CLANG_OPT="-Oz" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
24 NGX_CLANG_OPT="-O" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
25 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
26 case $CPU in |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
27 pentium) |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
28 # optimize for Pentium |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
29 CPU_OPT="-march=pentium" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
30 NGX_CPU_CACHE_LINE=32 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
31 ;; |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
32 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
33 pentiumpro | pentium3) |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
34 # optimize for Pentium Pro, Pentium II and Pentium III |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
35 CPU_OPT="-march=pentiumpro" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
36 NGX_CPU_CACHE_LINE=32 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
37 ;; |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
38 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
39 pentium4) |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
40 # optimize for Pentium 4 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
41 CPU_OPT="-march=pentium4" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
42 NGX_CPU_CACHE_LINE=128 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
43 ;; |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
44 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
45 athlon) |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
46 # optimize for Athlon |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
47 CPU_OPT="-march=athlon" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
48 NGX_CPU_CACHE_LINE=64 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
49 ;; |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
50 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
51 opteron) |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
52 # optimize for Opteron |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
53 CPU_OPT="-march=opteron" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
54 NGX_CPU_CACHE_LINE=64 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
55 ;; |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
56 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
57 esac |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
58 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
59 CC_AUX_FLAGS="$CC_AUX_FLAGS $CPU_OPT" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
60 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
61 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
62 CFLAGS="$CFLAGS -pipe $CPU_OPT" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
63 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
64 if [ ".$PCRE_OPT" = "." ]; then |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
65 PCRE_OPT="-O2 -pipe $CPU_OPT" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
66 else |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
67 PCRE_OPT="$PCRE_OPT -pipe" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
68 fi |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
69 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
70 if [ ".$ZLIB_OPT" = "." ]; then |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
71 ZLIB_OPT="-O2 -pipe $CPU_OPT" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
72 else |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
73 ZLIB_OPT="$ZLIB_OPT -pipe" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
74 fi |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
75 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
76 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
77 # warnings |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
78 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
79 CFLAGS="$CFLAGS $NGX_CLANG_OPT -Wall -Wextra -Wpointer-arith" |
5459
fedf777c6b24
Configure: enable -Wconditional-uninitialized with clang.
Ruslan Ermilov <ru@nginx.com>
parents:
5187
diff
changeset
|
80 CFLAGS="$CFLAGS -Wconditional-uninitialized" |
4762
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
81 #CFLAGS="$CFLAGS -Wmissing-prototypes" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
82 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
83 # we have a lot of unused function arguments |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
84 CFLAGS="$CFLAGS -Wno-unused-parameter" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
85 |
5714
80bd391c90d1
Configure: added -Wno-deprecated-declarations on OS X.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5539
diff
changeset
|
86 # deprecated system OpenSSL library on OS X |
80bd391c90d1
Configure: added -Wno-deprecated-declarations on OS X.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5539
diff
changeset
|
87 if [ "$NGX_SYSTEM" = "Darwin" ]; then |
80bd391c90d1
Configure: added -Wno-deprecated-declarations on OS X.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5539
diff
changeset
|
88 CFLAGS="$CFLAGS -Wno-deprecated-declarations" |
80bd391c90d1
Configure: added -Wno-deprecated-declarations on OS X.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5539
diff
changeset
|
89 fi |
80bd391c90d1
Configure: added -Wno-deprecated-declarations on OS X.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5539
diff
changeset
|
90 |
4762
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
91 # stop on warning |
5539
c86dd32573c0
Configure: enabled -Werror for clang.
Ruslan Ermilov <ru@nginx.com>
parents:
5459
diff
changeset
|
92 CFLAGS="$CFLAGS -Werror" |
4762
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
93 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
94 # debug |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
95 CFLAGS="$CFLAGS -g" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
96 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
97 if [ ".$CPP" = "." ]; then |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
98 CPP="$CC -E" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
99 fi |