summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/dist/s_void
blob: ab2f23a5fdd35abb9e2e43c4faf8308f4be1eed5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#! /bin/sh

t=__wt.$$
trap 'rm -f $t; exit 0' 0 1 2 3 13 15

cd ..

# Turn a C file into a line per function that returns an int.
file_parse()
{
	sed -n \
	    -e '/^int$/b loop' \
	    -e '/^static int$/b loop' \
	    -e 'd' \
	    -e ': loop' \
	    -e 'H' \
	    -e 'n' \
	    -e '/^}$/!b loop' \
	    -e 'H' \
	    -e 'x' \
	    -e 's/\n/ /g' \
	    -e 'p' \
	    -e 's/.*//' \
	    -e 'x' \
	    -e 'd' $1
}

# Strip out a list of functions that will be flagged, but are OK.
func_ok()
{
	sed \
	    -e '/int __bm_stat$/d' \
	    -e '/int __checkpoint_presync$/d' \
	    -e '/int __compact_uri_analyze$/d' \
	    -e '/int __curlog_reset$/d' \
	    -e '/int __handle_close_default$/d' \
	    -e '/int __handle_progress_default$/d' \
	    -e '/int __im_file_close$/d' \
	    -e '/int __im_file_lock$/d' \
	    -e '/int __im_file_size$/d' \
	    -e '/int __im_file_sync$/d' \
	    -e '/int __im_fs_directory_list_free$/d' \
	    -e '/int __im_fs_exist$/d' \
	    -e '/int __posix_file_close$/d' \
	    -e '/int __posix_terminate$/d' \
	    -e '/int __rec_destroy_session$/d' \
	    -e '/int __win_terminate$/d' \
	    -e '/int __wt_block_compact_end$/d' \
	    -e '/int __wt_block_compact_start$/d' \
	    -e '/int __wt_block_manager_size$/d' \
	    -e '/int __wt_block_write_size$/d' \
	    -e '/int __wt_curjoin_joined$/d' \
	    -e '/int __wt_cursor_close$/d' \
	    -e '/int __wt_cursor_noop$/d' \
	    -e '/int __wt_epoch$/d' \
	    -e '/int __wt_errno$/d' \
	    -e '/int __wt_get_vm_pagesize$/d' \
	    -e '/int __wt_lsm_manager_pop_entry$/d' \
	    -e '/int __wt_once$/d' \
	    -e '/int __wt_posix_directory_list_free$/d' \
	    -e '/int __wt_stat_connection_desc$/d' \
	    -e '/int __wt_stat_dsrc_desc$/d' \
	    -e '/int __wt_stat_join_desc$/d' \
	    -e '/int __wt_win_directory_list_free$/d' \
	    -e '/int bdb_compare_reverse$/d' \
	    -e '/int csv_terminate$/d' \
	    -e '/int demo_file_close$/d' \
	    -e '/int demo_file_lock$/d' \
	    -e '/int demo_file_size$/d' \
	    -e '/int demo_file_sync$/d' \
	    -e '/int demo_fs_directory_list_free$/d' \
	    -e '/int demo_fs_exist$/d' \
	    -e '/int handle_message$/d' \
	    -e '/int handle_progress$/d' \
	    -e '/int helium_cursor_reset$/d' \
	    -e '/int helium_session_verify$/d' \
	    -e '/int log_print_err$/d' \
	    -e '/int lz4_error$/d' \
	    -e '/int lz4_pre_size$/d' \
	    -e '/int lz4_terminate$/d' \
	    -e '/int main$/d' \
	    -e '/int nop_decompress$/d' \
	    -e '/int nop_decrypt$/d' \
	    -e '/int nop_pre_size$/d' \
	    -e '/int nop_sizing$/d' \
	    -e '/int nop_terminate$/d' \
	    -e '/int nop_terminate$/d' \
	    -e '/int os_errno$/d' \
	    -e '/int revint_terminate$/d' \
	    -e '/int rotn_error$/d' \
	    -e '/int rotn_sizing$/d' \
	    -e '/int rotn_terminate$/d' \
	    -e '/int uri2name$/d' \
	    -e '/int usage$/d' \
	    -e '/int util_err$/d' \
	    -e '/int wiredtiger_extension_init$/d' \
	    -e '/int wiredtiger_extension_terminate$/d' \
	    -e '/int wiredtiger_pack_close$/d' \
	    -e '/int wt_snappy_pre_size$/d' \
	    -e '/int wt_snappy_terminate$/d' \
	    -e '/int zlib_error$/d' \
	    -e '/int zlib_terminate$/d'
}

# Complain about functions which return an "int" but which don't return except
# at the end of the function. This script is a kluge and isn't run by default.
for f in `find bench ext src test -name '*.[ci]'`; do
	if expr "$f" : '.*/windows_shim.c' > /dev/null; then
		continue
	fi

	# Turn each function into a single line, then discard the function's
	# final "return" call, then discard any function that still has some
	# form of return assignment or call.
	file_parse $f |
	sed -e 's/return ([^)]*); }$//' \
	    -e '/[A-Z]*_API_CALL[A-Z_]*(/d' \
	    -e '/WT_CURSOR_NEEDKEY(/d' \
	    -e '/WT_CURSOR_NEEDVALUE(/d' \
	    -e '/WT_ERR[A-Z_]*(/d' \
	    -e '/WT_ILLEGAL_VALUE[A-Z_]*(/d' \
	    -e '/WT_PANIC[A-Z_]*(/d' \
	    -e '/WT_RET[A-Z_]*(/d' \
	    -e '/WT_TRET(/d' \
	    -e '/[^a-z_]ret = /d' \
	    -e '/[^a-z_]return (/d' \
	    -e 's/^\([^(]*\).*/\1/' \
	    -e 's/^ *//' |
	func_ok > $t
	test -s $t && {
		echo "========== $f"
		cat $t
	}
done