- Notifications
You must be signed in to change notification settings - Fork4.9k
Commita5abace
Fix -Wcast-function-type warnings
Three groups of issues needed to be addressed:load_external_function() and related functions returned PGFunction,even though not necessarily all callers are looking for a function oftype PGFunction. Since these functions are really just wrappersaround dlsym(), change to return void * just like dlsym().In dynahash.c, we are using strlcpy() where a function with asignature like memcpy() is expected. This should be safe, as the newcomment there explains, but the cast needs to be augmented to avoidthe warning.In PL/Python, methods all need to be cast to PyCFunction, per PythonAPI, but this now runs afoul of these warnings. (This issue alsoexists in core CPython.)To fix the second and third case, we add a new type pg_funcptr_t thatis defined specifically so that gcc accepts it as a special functionpointer that can be cast to any other function pointer without thewarning.Also add -Wcast-function-type to the standard warning flags, subjectto configure check.Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://www.postgresql.org/message-id/flat/1e97628e-6447-b4fd-e230-d109cec2d584%402ndquadrant.com(cherry picked from commitde8feb1)Author: Peter Eisentraut <peter@eisentraut.org>Author: Alexandra Wang <alexandra.wang.oss@gmail.com>1 parentf1cf641 commita5abace
File tree
7 files changed
+127
-18
lines changed- src
- backend/utils
- fmgr
- hash
- include
- pl/plpython
7 files changed
+127
-18
lines changedLines changed: 91 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5645 | 5645 |
| |
5646 | 5646 |
| |
5647 | 5647 |
| |
| 5648 | + | |
| 5649 | + | |
| 5650 | + | |
| 5651 | + | |
| 5652 | + | |
| 5653 | + | |
| 5654 | + | |
| 5655 | + | |
| 5656 | + | |
| 5657 | + | |
| 5658 | + | |
| 5659 | + | |
| 5660 | + | |
| 5661 | + | |
| 5662 | + | |
| 5663 | + | |
| 5664 | + | |
| 5665 | + | |
| 5666 | + | |
| 5667 | + | |
| 5668 | + | |
| 5669 | + | |
| 5670 | + | |
| 5671 | + | |
| 5672 | + | |
| 5673 | + | |
| 5674 | + | |
| 5675 | + | |
| 5676 | + | |
| 5677 | + | |
| 5678 | + | |
| 5679 | + | |
| 5680 | + | |
| 5681 | + | |
| 5682 | + | |
| 5683 | + | |
| 5684 | + | |
| 5685 | + | |
| 5686 | + | |
| 5687 | + | |
| 5688 | + | |
| 5689 | + | |
| 5690 | + | |
| 5691 | + | |
| 5692 | + | |
| 5693 | + | |
| 5694 | + | |
| 5695 | + | |
| 5696 | + | |
| 5697 | + | |
| 5698 | + | |
| 5699 | + | |
| 5700 | + | |
| 5701 | + | |
| 5702 | + | |
| 5703 | + | |
| 5704 | + | |
| 5705 | + | |
| 5706 | + | |
| 5707 | + | |
| 5708 | + | |
| 5709 | + | |
| 5710 | + | |
| 5711 | + | |
| 5712 | + | |
| 5713 | + | |
| 5714 | + | |
| 5715 | + | |
| 5716 | + | |
| 5717 | + | |
| 5718 | + | |
| 5719 | + | |
| 5720 | + | |
| 5721 | + | |
| 5722 | + | |
| 5723 | + | |
| 5724 | + | |
| 5725 | + | |
| 5726 | + | |
| 5727 | + | |
| 5728 | + | |
| 5729 | + | |
| 5730 | + | |
| 5731 | + | |
| 5732 | + | |
| 5733 | + | |
| 5734 | + | |
| 5735 | + | |
| 5736 | + | |
| 5737 | + | |
| 5738 | + | |
5648 | 5739 |
| |
5649 | 5740 |
| |
5650 | 5741 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
498 | 498 |
| |
499 | 499 |
| |
500 | 500 |
| |
| 501 | + | |
| 502 | + | |
501 | 503 |
| |
502 | 504 |
| |
503 | 505 |
| |
|
Lines changed: 7 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
95 | 95 |
| |
96 | 96 |
| |
97 | 97 |
| |
98 |
| - | |
| 98 | + | |
99 | 99 |
| |
100 | 100 |
| |
101 | 101 |
| |
102 | 102 |
| |
103 | 103 |
| |
104 | 104 |
| |
105 | 105 |
| |
106 |
| - | |
| 106 | + | |
107 | 107 |
| |
108 | 108 |
| |
109 | 109 |
| |
110 | 110 |
| |
111 | 111 |
| |
112 |
| - | |
| 112 | + | |
113 | 113 |
| |
114 | 114 |
| |
115 | 115 |
| |
| |||
122 | 122 |
| |
123 | 123 |
| |
124 | 124 |
| |
125 |
| - | |
| 125 | + | |
126 | 126 |
| |
127 | 127 |
| |
128 | 128 |
| |
| |||
165 | 165 |
| |
166 | 166 |
| |
167 | 167 |
| |
168 |
| - | |
| 168 | + | |
169 | 169 |
| |
170 |
| - | |
| 170 | + | |
171 | 171 |
| |
172 | 172 |
| |
173 |
| - | |
| 173 | + | |
174 | 174 |
| |
175 | 175 |
| |
176 | 176 |
| |
|
Lines changed: 10 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
398 | 398 |
| |
399 | 399 |
| |
400 | 400 |
| |
401 |
| - | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
402 | 411 |
| |
403 | 412 |
| |
404 | 413 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
277 | 277 |
| |
278 | 278 |
| |
279 | 279 |
| |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
280 | 287 |
| |
281 | 288 |
| |
282 | 289 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
716 | 716 |
| |
717 | 717 |
| |
718 | 718 |
| |
719 |
| - | |
720 |
| - | |
721 |
| - | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
722 | 722 |
| |
723 | 723 |
| |
724 | 724 |
| |
|
Lines changed: 7 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
59 | 59 |
| |
60 | 60 |
| |
61 | 61 |
| |
62 |
| - | |
63 |
| - | |
64 |
| - | |
65 |
| - | |
66 |
| - | |
67 |
| - | |
68 |
| - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
69 | 69 |
| |
70 | 70 |
| |
71 | 71 |
| |
|
0 commit comments
Comments
(0)