1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
5 # Fuzz is a script whose purpose is to check through ACE/TAO files for
6 # easy to spot (by a perl script, at least) problems.
8 use lib
"$ENV{ACE_ROOT}/bin";
9 if (defined $ENV{srcdir
}) {
10 use lib
"$ENV{srcdir}/bin";
17 use PerlACE
::Run_Test
;
21 # Add tests for these:
23 # - Guards in .h files
24 # - no global functions
25 # - other commit_check checks
27 # And others in ACE_Guidelines and Design Rules
29 # Also add a -g flag to ignore tao_idl generated files
33 # Lists of all the files
45 @files_changelog = ();
59 # To keep track of errors and warnings
63 # to register suppressed tests
64 %suppressed_tests = ();
66 # to register excluded directories
69 ##############################################################################
71 # Use 'git status -s' to get a list of locally modified
72 # files to look through
73 sub find_mod_git_files
()
75 unless (open (GIT
, "git status -s |")) {
76 print STDERR
"Error: Could not run git\n";
81 if (/^ [MA] +(.*)$/) {
91 if (!find_mod_git_files
()) {
92 print "Could use git to find modified files\n";
100 # exclude will contain the full file name
102 foreach (@excluded_dirs) {
103 if ($exclude =~ /$_/) {
110 # Find_Files will search for files with certain extensions in the
114 # wanted is only used for the File::Find
117 store_file
($File::Find
::name
);
120 find
(\
&wanted
, '.');
128 return if is_excluded
($name);
130 if ($name =~ /\.(c|cc|cpp|cxx|tpp)$/i) {
131 push @files_cpp, ($name);
133 elsif ($name =~ /\.(inl|i)$/i) {
134 push @files_inl, ($name);
136 elsif ($name =~ /\.(h|hh|hpp|hxx)$/i) {
137 push @files_h, ($name);
139 elsif ($name =~ /\.(htm|html)$/i) {
140 push @files_html, ($name);
142 elsif ($name =~ /\.(bor)$/i) {
143 push @files_bor, ($name);
145 elsif ($name =~ /\.(GNU)$/i) {
146 push @files_gnu, ($name);
148 elsif ($name =~ /\.(dsp|vcp)$/i) {
149 push @files_dsp, ($name);
151 elsif ($name =~ /\.(dsw|vcp)$/i) {
152 push @files_dsw, ($name);
154 elsif ($name =~ /\.(pidl|idl|idl3|idl3p)$/i) {
155 push @files_idl, ($name);
157 elsif ($name =~ /\.pl$/i) {
158 if ($name =~ /fuzz.pl/) {
161 push @files_pl, ($name);
162 if ($name =~ /^run.*\.pl$/i) {
163 push @files_run_pl, ($name);
166 elsif ($name =~ /\.py$/i) {
167 push @files_py, ($name);
169 elsif ($name =~ /\.(rb|erb)$/i) {
170 push @files_rb, ($name);
172 elsif ($name =~ /\.features$/i) {
173 push @files_features, ($name);
175 elsif ($name =~ /\.vcproj$/i) {
176 push @files_vcproj, ($name);
178 elsif ($name =~ /\.sln$/i) {
179 push @files_sln, ($name);
181 elsif ($name =~ /ChangeLog/i && -f
$name) {
182 push @files_changelog, ($name);
184 elsif ($name =~ /\/GNUmakefile
.*.[^~]$/) {
185 push @files_makefile, ($name);
187 elsif ($name =~ /\.(mpc|mwc|mpb|mpt)$/i) {
188 push @files_mpc, ($name);
190 elsif ($name =~ /\.(icc|ncb|zip)$/i) {
191 push @files_noncvs, ($name);
193 elsif ($name =~ /\.(cdp)$/i) {
194 push @files_cdp, ($name);
196 elsif ($name =~ /\.(doxygen)$/i) {
197 push @files_doxygen, ($name);
199 elsif ($name =~ /\.(conf)$/i) {
200 if ($name =~ /\.(WCHAR_T.conf|UTF-16.conf)$/i) {
203 push @files_conf, ($name);
205 elsif ($name =~ /\.(conf.xml)$/i) {
206 if ($name =~ /\.(WCHAR_T.conf.xml|UTF-16.conf.xml)$/i) {
209 push @files_conf, ($name);
211 elsif ($name =~ /\.(pm|cmd|java|sh|txt|xml)$/i) {
212 push @files_generic, ($name);
214 elsif ($name =~ /README$/i) {
215 push @files_generic, ($name);
219 ##############################################################################
225 print "Error: $msg\n";
230 sub print_warning
($)
233 print "Warning: $msg\n";
237 ##############################################################################
238 ## Check if test is suppressed
242 my $method = (split (/::/, (caller(1))[3]))[-1];
243 return (defined $suppressed_tests{$method} ?
1 : 0);
246 ##############################################################################
249 # The point of this test is to check for the existence of ACE_INLINE
250 # or ASYS_INLINE in a .cpp file. This is most commonly caused by
251 # copy/pasted code from a .inl/.i file
252 sub check_for_inline_in_cpp
()
254 return if is_suppressed
();
256 print "Running ACE_INLINE/ASYS_INLINE check\n";
257 foreach $file (@files_cpp) {
258 if (open (FILE
, $file)) {
259 print "Looking at file $file\n" if $opt_d;
262 print_error
("$file:$.: ACE_INLINE found");
264 if (/^ASYS_INLINE/) {
265 print_error
("$file:$.: ASYS_INLINE found");
271 print STDERR
"Error: Could not open $file\n";
276 # This test checks to make sure we have no files with $Id string in them.
277 sub check_for_id_string
()
279 return if is_suppressed
();
281 print "Running \$Id\$ string check\n";
282 foreach $file (@files_cpp, @files_inl, @files_h, @files_mpc, @files_bor,
283 @files_gnu, @files_html, @files_idl, @files_pl,
284 @files_cdp, @files_py, @files_conf, @files_generic, @files_features) {
286 if (open (FILE
, $file)) {
287 print "Looking at file $file\n" if $opt_d;
290 print_error
("$file:$.: Incorrect \$id\$ found (correct casing)");
293 print_error
("$file:$.: Incorrect \$Id:\$ found (remove colon)");
295 if (/\$Id\$/ || /\$Id: /) {
301 print_error
("$file: \$Id\$ string found, not used anymore.");
305 print STDERR
"Error: Could not open $file\n";
311 sub check_for_msc_ver_string
()
313 return if is_suppressed
();
315 print "Running _MSC_VER check\n";
316 foreach $file (@files_cpp, @files_inl, @files_h) {
318 if (open (FILE
, $file)) {
321 print "Looking at file $file\n" if $opt_d;
323 if (/FUZZ\: disable check_for_msc_ver/) {
326 if (/FUZZ\: enable check_for_msc_ver/) {
329 if ($disable == 0 and /\_MSC_VER \<= 1200/) {
333 if ($disable == 0 and /\_MSC_VER \>= 1200/) {
337 if ($disable == 0 and /\_MSC_VER \> 1200/) {
341 if ($disable == 0 and /\_MSC_VER \< 1300/) {
345 if ($disable == 0 and /\_MSC_VER \<= 1300/) {
349 if ($disable == 0 and /\_MSC_VER \>= 1300/) {
353 if ($disable == 0 and /\_MSC_VER \< 1310/) {
357 if ($disable == 0 and /\_MSC_VER \>= 1310/) {
364 print_error
("$file:$mscline: Incorrect _MSC_VER check found");
368 print STDERR
"Error: Could not open $file\n";
373 # This test checks for the newline at the end of a file
374 sub check_for_newline
()
376 return if is_suppressed
();
378 print "Running newline check\n";
379 foreach $file (@files_cpp, @files_inl, @files_h,
380 @files_html, @files_idl, @files_pl) {
381 if (open (FILE
, $file)) {
383 print "Looking at file $file\n" if $opt_d;
388 if ($line !~ /\n$/) {
389 print_error
("$file:$.: No ending newline found in $file");
393 print STDERR
"Error: Could not open $file\n";
399 # This test checks for files that are not allowed to be in version control
400 sub check_for_noncvs_files
()
402 return if is_suppressed
();
404 print "Running non versioned controlled files check\n";
405 foreach $file (@files_noncvs, @files_dsp, @files_dsw, @files_makefile, @files_bor) {
406 print_error
("File $file should not be in version control!");
410 # This test checks for the use of ACE_SYNCH_MUTEX in TAO,
411 # TAO_SYNCH_MUTEX should used instead.
413 sub check_for_ACE_SYNCH_MUTEX
()
415 return if is_suppressed
();
417 print "Running ACE_SYNCH_MUTEX check\n";
418 ITERATION
: foreach $file (@files_cpp, @files_inl, @files_h) {
419 if (open (FILE
, $file)) {
421 print "Looking at file $file\n" if $opt_d;
423 if (/FUZZ\: disable check_for_ACE_SYNCH_MUTEX/) {
426 if (/FUZZ\: enable check_for_ACE_SYNCH_MUTEX/) {
430 if ($disable == 0 and /ACE_SYNCH_MUTEX/) {
431 # It is okay to use ACE_SYNCH_MUTEX in ACE
432 # so don't check the ACE directory. The below
433 # will check it for TAO
434 if (($file !~ /.*TAO.*/)) {
438 # Disable the check in the ESF directory for the
439 # time being until we fix the issues there.
440 if(($file =~ /.*TAO\/orbsvcs\
/orbsvcs\/ESF
.*/)) {
444 print_error
("$file:$.: found ACE_SYNCH_MUTEX, use TAO_SYNCH_MUTEX instead");
450 print STDERR
"Error: Could not open $file\n";
455 # This test checks for the use of ACE_Thread_Mutex in TAO,
456 # TAO_SYNCH_MUTEX should used instead to make the code build
457 # in single-threaded builds.
458 sub check_for_ACE_Thread_Mutex
()
460 return if is_suppressed
();
462 print "Running ACE_Thread_Mutex check\n";
463 ITERATION
: foreach $file (@files_cpp, @files_inl, @files_h) {
464 if (open (FILE
, $file)) {
466 print "Looking at file $file\n" if $opt_d;
468 if (/FUZZ\: disable check_for_ACE_Thread_Mutex/) {
471 if (/FUZZ\: enable check_for_ACE_Thread_Mutex/) {
475 if ($disable == 0 and /ACE_Thread_Mutex/) {
476 # It is okay to use ACE_Thread_Mutex in ACE
477 # so don't check the ACE directory. The below
478 # will check it for TAO
479 if (($file !~ /.*TAO.*/)) {
483 print_error
("$file:$.: found ACE_Thread_Mutex, use TAO_SYNCH_MUTEX instead to allow the code to work in single-threaded builds");
489 print STDERR
"Error: Could not open $file\n";
494 # This test checks for the use of ACE_Guard
495 # ACE_GUARD should used because it checks if we really got a lock
496 # in single-threaded builds.
497 sub check_for_ACE_Guard
()
499 return if is_suppressed
();
501 print "Running ACE_Guard check\n";
502 ITERATION
: foreach $file (@files_cpp, @files_inl, @files_h) {
503 if (open (FILE
, $file)) {
505 print "Looking at file $file\n" if $opt_d;
507 if (/FUZZ\: disable check_for_ACE_Guard/) {
510 if (/FUZZ\: enable check_for_ACE_Guard/) {
514 if ($disable == 0 and /ACE_Guard/) {
515 print_error
("$file:$.: found ACE_Guard, use ACE_GUARD");
517 if ($disable == 0 and /ACE_Read_Guard/) {
518 print_error
("$file:$.: found ACE_Read_Guard, use ACE_READ_GUARD");
520 if ($disable == 0 and /ACE_Write_Guard/) {
521 print_error
("$file:$.: found ACE_Write_Guard, use ACE_WRITE_GUARD");
527 print STDERR
"Error: Could not open $file\n";
532 # This test checks for the use of tabs, spaces should be used instead of tabs
535 return if is_suppressed
();
537 print "Running tabs check\n";
538 ITERATION
: foreach $file (@files_cpp, @files_inl, @files_h, @files_idl, @files_cdp, @files_doxygen, @files_changelog) {
539 if (open (FILE
, $file)) {
541 print "Looking at file $file\n" if $opt_d;
543 if (/FUZZ\: disable check_for_tab/) {
546 if (/FUZZ\: enable check_for_tab/) {
549 if ($disable == 0 and /.*\t.*/) {
550 print_error
("$file:$.: found tab");
556 print STDERR
"Error: Could not open $file\n";
561 sub check_for_trailing_whitespace
()
563 return if is_suppressed
();
565 print "Running trailing_whitespaces check\n";
566 ITERATION
: foreach $file (@files_cpp, @files_inl, @files_h, @files_idl,
567 @files_cdp, @files_pl, @files_py, @files_generic) {
568 if (open (FILE
, $file)) {
570 print "Looking at file $file\n" if $opt_d;
572 if (/FUZZ\: disable check_for_trailing_whitespace/) {
575 if (/FUZZ\: enable check_for_trailing_whitespace/) {
578 if ($disable == 0 and /\s\n$/) {
579 print_error
("$file:$.: found trailing whitespace");
585 print STDERR
"Error: Could not open $file\n";
590 # This test checks for the lack of ACE_OS
591 sub check_for_lack_ACE_OS
()
593 return if is_suppressed
();
595 $OS_NS_arpa_inet_symbols = "inet_addr|inet_aton|inet_ntoa|inet_ntop|inet_pton";
597 $OS_NS_ctype_symbols = "isalnum|isalpha|iscntrl|isdigit|isgraph|islower|isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper|isblank|isascii|isctype|iswctype";
599 $OS_NS_dirent_symbols = "closedir|opendir|readdir|readdir_r|rewinddir|scandir|alphasort|seekdir|telldir|opendir_emulation|scandir_emulation|closedir_emulation|readdir_emulation";
601 $OS_NS_dlfcn_symbols = "dlclose|dlerror|dlopen|dlsym";
603 $OS_NS_errno_symbols = "last_error|set_errno_to_last_error|set_errno_to_wsa_last_error";
605 $OS_NS_fcntl_symbols = "fcntl|open";
607 $OS_NS_math_symbols = "floor|ceil|log2";
609 $OS_NS_netdb_symbols = "gethostbyaddr|gethostbyaddr_r|gethostbyname|gethostbyname_r|getipnodebyaddr|getipnodebyname|getmacaddress|getprotobyname|getprotobyname_r|getprotobynumber|getprotobynumber_r|getservbyname|getservbyname_r|netdb_acquire|netdb_release";
611 $OS_NS_poll_symbols = "poll";
613 $OS_NS_pwd_symbols = "endpwent|getpwent|getpwnam|getpwnam_r|setpwent";
615 $OS_NS_regex_symbols = "compile|step";
617 $OS_NS_signal_symbols = "kill|pthread_sigmask|sigaction|sigaddset|sigdelset|sigemptyset|sigfillset|sigismember|signal|sigprocmask|sigsuspend|raise";
619 $OS_NS_stdio_symbols = "fileno|checkUnicodeFormat|clearerr|cuserid|fclose|fdopen|fflush|fgetc|getc|fgetpos|fgets|flock_adjust_params|flock_init|flock_destroy|flock_rdlock|flock_tryrdlock|flock_trywrlock|flock_unlock|flock_wrlock|fopen|default_win32_security_attributes|default_win32_security_attributes_r|get_win32_versioninfo|get_win32_resource_module|set_win32_resource_module|fprintf|ungetc|fputc|putc|fputs|fread|freopen|fseek|fsetpos|ftell|fwrite|perror|printf|puts|rename|rewind|snprintf|sprintf|tempnam|vsprintf|vsnprintf|asprintf|aswprintf|vasprintf|vaswprintf";
621 $OS_NS_stdlib_symbols = "_exit|abort|atexit|atof|atol|atoi|atop|bsearch|calloc|exit|free|getenv|getenvstrings|itoa|itoa_emulation|itow_emulation|malloc|mkstemp|mkstemp_emulation|mktemp|setenv|unsetenv|putenv|qsort|rand|rand_r|realloc|realpath|set_exit_hook|srand|strenvdup|strtod|strtol|strtol_emulation|strtoul|strtoul_emulation|strtoll|strtoll_emulation|strtoull|strtoull_emulation|system|getprogname|setprogname";
623 $OS_NS_string_symbols = "memchr|memchr_emulation|memcmp|memcpy|fast_memcpy|memmove|memset|strcat|strchr|strcmp|strcpy|strcspn|strdup|strdup_emulation|strecpy|strerror|strerror_emulation|strsignal|strlen|strncat|strnchr|strncmp|strncpy|strnlen|strnstr|strpbrk|strrchr|strrchr_emulation|strsncpy|strspn|strstr|strtok|strtok_r|strtok_r_emulation";
625 $OS_NS_strings_symbols = "strcasecmp|strncasecmp|strcasecmp_emulation";
627 $OS_NS_stropts_symbols = "getmsg|getpmsg|fattach|fdetach|ioctl|isastream|putmsg|putpmsg";
629 $OS_NS_sys_mman_symbols = "madvise|mmap|mprotect|msync|munmap|shm_open|shm_unlink";
631 $OS_NS_sys_msg_symbols = "msgctl|msgget|msgrcv|msgsnd";
633 $OS_NS_sys_resource_symbols = "getrlimit|getrusage|setrlimit";
635 $OS_NS_sys_select_symbols = "select";
637 $OS_NS_sys_sendfile_symbols = "sendfile|sendfile_emulation";
639 $OS_NS_sys_shm_symbols = "shmat|shmctl|shmdt|shmget";
641 $OS_NS_sys_socket_symbols = "accept|bind|closesocket|connect|enum_protocols|getpeername|getsockname|getsockopt|join_leaf|listen|recv|recvfrom|recvmsg|recvv|send|sendmsg|sendto|sendv|setsockopt|shutdown|if_nametoindex|if_indextoname|if_nameindex|socket_init|socket_fini|socket|socketpair";
643 $OS_NS_sys_stat_symbols = "creat|filesize|fstat|lstat|mkdir|mkfifo|stat|umask";
645 $OS_NS_sys_time_symbols = "gettimeofday";
647 $OS_NS_sys_uio_symbols = "readv|readv_emulation|writev|writev_emulation";
649 $OS_NS_sys_utsname_symbols = "uname";
651 $OS_NS_sys_wait_symbols = "wait|waitpid";
653 $OS_NS_Thread_symbols = "cleanup_tss|condattr_init|condattr_destroy|cond_broadcast|cond_destroy|cond_init|cond_signal|cond_timedwait|cond_wait|event_destroy|event_init|event_pulse|event_reset|event_signal|event_timedwait|event_wait|lwp_getparams|lwp_setparams|mutex_destroy|mutex_init|mutex_lock|mutex_lock_cleanup|mutex_trylock|mutex_unlock|priority_control|recursive_mutex_cond_unlock|recursive_mutex_cond_relock|recursive_mutex_destroy|recursive_mutex_init|recursive_mutex_lock|recursive_mutex_trylock|recursive_mutex_unlock|rw_rdlock|rw_tryrdlock|rw_trywrlock|rw_trywrlock_upgrade|rw_unlock|rw_wrlock|rwlock_destroy|rwlock_init|sched_params|scheduling_class|sema_destroy|sema_init|sema_post|sema_trywait|sema_wait|semctl|semget|semop|set_scheduling_params|sigtimedwait|sigwait|sigwaitinfo|thr_cancel|thr_cmp|thr_continue|thr_create|thr_equal|thr_exit|thr_getconcurrency|thr_getprio|thr_getspecific_native|thr_getspecific|thr_join|thr_get_affinity|thr_set_affinity|thr_key_detach|thr_key_used|thr_keycreate_native|thr_keycreate|thr_keyfree|thr_kill|thr_min_stack|thr_self|thr_setcancelstate|thr_setcanceltype|thr_setconcurrency|thr_setprio|thr_setspecific_native|thr_setspecific|thr_sigsetmask|thr_suspend|thr_testcancel|thr_yield|thread_mutex_destroy|thread_mutex_init|thread_mutex_lock|thread_mutex_trylock|thread_mutex_unlock|unique_name";
655 $OS_NS_time_symbols = "asctime|asctime_r|clock_gettime|clock_settime|ctime|ctime_r|difftime|gmtime|gmtime_r|localtime|localtime_r|mktime|nanosleep|readPPCTimeBase|strftime|strptime|strptime_emulation|strptime_getnum|time|timezone|tzset";
657 $OS_NS_unistd_symbols = "access|alarm|allocation_granularity|argv_to_string|chdir|rmdir|close|dup|dup2|execl|execle|execlp|execv|execve|execvp|fork|fork_exec|fsync|ftruncate|getcwd|getgid|getegid|getopt|getpagesize|getpgid|getpid|getppid|getuid|geteuid|hostname|isatty|lseek|llseek|num_processors|num_processors_online|pipe|pread|pwrite|read|read_n|readlink|sbrk|setgid|setegid|setpgid|setregid|setreuid|setsid|setuid|seteuid|sleep|string_to_argv|swab|sysconf|sysinfo|truncate|ualarm|unlink|write|write_n";
659 $OS_NS_wchar_symbols = "fgetwc|wcscat_emulation|wcschr_emulation|wcscmp_emulation|wcscpy_emulation|wcscspn_emulation|wcsicmp_emulation|wcslen_emulation|wcsncat_emulation|wcsncmp_emulation|wcsncpy_emulation|wcsnicmp_emulation|wcspbrk_emulation|wcsrchr_emulation|wcsrchr_emulation|wcsspn_emulation|wcsstr_emulation|wslen|wscpy|wscmp|wsncmp|ungetwc";
661 print "Running ACE_OS check\n";
662 foreach $file (@files_cpp, @files_inl) {
663 if (open (FILE
, $file)) {
665 print "Looking at file $file\n" if $opt_d;
667 if (/FUZZ\: disable check_for_lack_ACE_OS/) {
670 if (/FUZZ\: enable check_for_lack_ACE_OS/) {
674 if($file !~ /.c$/ && $file !~ /S.cpp$/ && $file !~ /S.inl$/ && $file !~ /C.cpp$/ && $file !~ /C.inl$/) {
675 if($file !~ /OS_NS_arpa_inet/) {
676 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_arpa_inet_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
677 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_arpa_inet.h");
680 if($file !~ /OS_NS_ctype/) {
681 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_ctype_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
682 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_ctype.h");
685 if($file !~ /OS_NS_dirent/) {
686 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_dirent_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
687 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_dirent.h");
690 if($file !~ /OS_NS_dlfcn/) {
691 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_dlfcn_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
692 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_dlfcn.h");
695 if($file !~ /OS_NS_errno/) {
696 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_errno_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
697 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_errno.h");
700 if($file !~ /OS_NS_fcntl/) {
701 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_fcntl_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
702 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_fcntl.h");
705 if($file !~ /OS_NS_math/) {
706 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_math_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
707 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_math.");
710 if($file !~ /OS_NS_netdb/) {
711 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_netdb_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
712 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_netdb.h");
715 if($file !~ /OS_NS_poll/) {
716 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_netdb_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
717 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_poll.h");
720 if($file !~ /OS_NS_pwd/) {
721 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_pwd_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
722 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_pwd.h");
725 if($file !~ /OS_NS_regex/) {
726 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_regex_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
727 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_regex.h");
730 if($file !~ /OS_NS_signal/) {
731 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_signal_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
732 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_signal.h");
735 if($file !~ /OS_NS_stdlib/) {
736 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_stdlib_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
737 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_stdlib.h");
740 if($file !~ /OS_NS_stdio/) {
741 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_stdio_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
742 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_stdio.h");
745 if($file !~ /OS_NS_string/) {
746 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_string_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
747 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_string.h");
750 if($file !~ /OS_NS_strings/) {
751 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_strings_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
752 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_strings.h");
755 if($file !~ /OS_NS_stropts/) {
756 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_stropts_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
757 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_stropts.h");
760 if($file !~ /OS_NS_sys_mman/) {
761 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_mman_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
762 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_sys_mman.h");
765 if($file !~ /OS_NS_sys_msg/) {
766 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_msg_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
767 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_sys_msg.h");
770 if($file !~ /OS_NS_sys_resource/) {
771 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_resource_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
772 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_sys_resource.h");
775 if($file !~ /OS_NS_sys_select/) {
776 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_select_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
777 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_sys_select.h");
780 if($file !~ /OS_NS_sys_sendfile/) {
781 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_sendfile_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
782 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_sys_sendfile.h");
785 if($file !~ /OS_NS_sys_shm/) {
786 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_shm_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
787 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_sys_shm.h");
790 if($file !~ /OS_NS_sys_socket/) {
791 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_socket_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
792 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_sys_socket.h");
795 if($file !~ /OS_NS_sys_stat/) {
796 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_stat_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
797 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_sys_stat.h");
800 if($file !~ /OS_NS_sys_time/) {
801 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_time_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
802 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_sys_time.h");
805 if($file !~ /OS_NS_sys_uio/) {
806 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_uio_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
807 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_sys_uio.h");
810 if($file !~ /OS_NS_sys_utsname/) {
811 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_utsname_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
812 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_sys_utsname.h");
815 if($file !~ /OS_NS_sys_wait/) {
816 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_wait_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
817 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_sys_wait.h");
820 if($file !~ /OS_NS_Thread/) {
821 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_Thread_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
822 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_Thread.h");
825 if($file !~ /OS_NS_time/) {
826 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_time_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
827 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_time.h");
830 if($file !~ /OS_NS_unistd/) {
831 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_unistd_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
832 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_unistd.h");
835 if($file !~ /OS_NS_wchar/) {
836 if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_wchar_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
837 print_error
("$file:$.: missing ACE_OS use ace/OS_NS_wchar.h");
846 print STDERR
"Error: Could not open $file\n";
851 # This test checks for the use of exception specification,
852 # exception specification has fallen out of favor, and generally
853 # should not be used.
854 sub check_for_exception_spec
()
856 return if is_suppressed
();
858 print "Running exception specification check\n";
860 foreach $file (@files_cpp, @files_inl, @files_h) {
861 if (open (FILE
, $file)) {
863 print "Looking at file $file\n" if $opt_d;
865 if (/FUZZ\: disable check_for_exception_sepc/) {
868 if (/FUZZ\: enable check_for_exception_sepc/) {
872 if(/throw\s*\(\s*\)/) {
875 elsif(/(^|\s+)throw\s*\(/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
876 print_error
("$file:$.: exception specification found");
883 print STDERR
"Error: Could not open $file\n";
888 # This test checks for the use of NULL,
889 # NULL shouldn't be used, use 0 instead
890 sub check_for_NULL
()
892 return if is_suppressed
();
894 print "Running NULL usage check\n";
896 foreach $file (@files_cpp, @files_inl, @files_h) {
897 if (open (FILE
, $file)) {
899 print "Looking at file $file\n" if $opt_d;
901 if (/FUZZ\: disable check_for_NULL/) {
904 if (/FUZZ\: enable check_for_NULL/) {
908 if(/(\(|\)|\s+|=)NULL(\)|\s+|\;|\,)/ and $` !~ /\/\// and $` !~ /\/\
*/ and $` !~ /\
*\
*+/ and $` !~ /\s
+\
*+\s
+/) {
909 print_error
("$file:$.: NULL found, use nullptr");
916 print STDERR
"Error: Could not open $file\n";
921 # This test checks for improper main declaration,
922 # the proper form should look like:
923 # int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
924 sub check_for_improper_main_declaration
()
926 return if is_suppressed
();
928 print "Running Improper main() declaration check\n";
930 foreach $file (@files_cpp) {
931 if (open (FILE
, $file)) {
935 my $not_found_end_line_count= 0;
936 print "Looking at file $file\n" if $opt_d;
938 if (!defined $multi_line) {
939 if (/FUZZ\: disable check_for_improper_main_declaration/) {
943 elsif (/FUZZ\: enable check_for_improper_main_declaration/) {
947 elsif ($disable == 0) {
948 s/^\s+//; ## Remove leading space
949 s/\s*(\/\/.*)?
$//; ## Remove trailing space and line comments
950 if (s/^(?:.*\s)?(main|ACE_TMAIN)\s*//) {
951 $type_of_main = $1; ## main or ACE_TMAIN
952 $multi_line = $_; ## Rest of the line
960 $_ =~ s/^\s+//; ## Remove leading space
961 $_ =~ s/\s*(\/\/.*)?
$//; ## Remove trailling space and line comments
962 if ($multi_line eq "") { ## Append this line to existing statement.
966 $multi_line .= ' ' . $_;
969 $multi_line =~ s!^(/+\*.*?\*/\s*)*!!; ## Remove leading /* ... */ comments
970 next if ($multi_line eq ""); ## Must have something after main
971 if ($multi_line !~ m/^\(/) {
972 ## Not a function opening bracket, we will ignore this one
973 ## it is not a main function.
975 $not_found_end_line_count = 0;
977 elsif ($multi_line =~ s/^\(\s*([^\)]*?)\s*\)[^;\{]*?\{//) {
978 $multi_line = $1; ## What was between the main's ( and )
979 $multi_line =~ s/\s{2,}/ /g; ## Compress white space
980 my $was = $multi_line;
981 $multi_line =~ s!([^/])\*\s([^/])!$1\*$2!g; ## Remove space after * (except around comment)
982 $multi_line =~ s!([^/])\s\[!$1\[!g; ## Remove space before [ (except following comment)
983 $multi_line =~ s!\s?\*/\s?/\*\s?! !g; ## Connect seporate adjacent /* ... */ comments
984 if ($multi_line =~ s!^([^,]*?)\s?,\s?(/+\*.*?\*/\s?)*!!) { # Fails if only 1 parameter (ignore this main)
986 if ($multi_line =~ s/^(\w[\w\d]*)\s?//) { # Fails if no type for 2nd parameter (ignore this main)
988 $multi_line =~ s!^(?:/+\*.*?\*/\s?)?(\**)(\w[\w\d]*|\s?/\*.*?\*/\s?)?!!;
989 my $prefix = $1; ## should be * or **
990 my $name = $2; ## is now arg2's variable name
991 $multi_line =~ s!\s?\*/\s?/\*\s?! !g; ## Connect seporate adjacent /* ... */ comments
993 ## remove any comment after postfix
994 if ($multi_line =~ s!\s?(/+\*.*?\*/)$!! && $name eq '') {
995 $name = "$1 "; ## Some name argv in comment after []
997 ## multi_line now postfix, should be []
999 if ($type_of_main ne 'ACE_TMAIN' ||
1000 $arg2_type ne 'ACE_TCHAR' ||
1001 !(($prefix eq '*' && $multi_line eq '[]') ||
1002 ($prefix eq '**' && $multi_line eq '' )) ) {
1003 print_error
("$file:$.: $type_of_main ($was) should be ACE_TMAIN ($arg1, ACE_TCHAR \*$name\[])");
1009 $not_found_end_line_count = 0;
1011 elsif ($not_found_end_line_count < 10) { # Limit the search for ( ... ) following main to ten lines
1012 ++$not_found_end_line_count;
1016 $not_found_end_line_count = 0;
1022 print STDERR
"Error: Could not open $file\n";
1027 # This test checks for the use of "inline" instead of ACE_INLINE
1028 sub check_for_inline
()
1030 return if is_suppressed
();
1032 print "Running inline check\n";
1033 foreach $file (@files_inl) {
1034 if (open (FILE
, $file)) {
1036 print "Looking at file $file\n" if $opt_d;
1038 if (/FUZZ\: disable check_for_inline/) {
1041 if (/FUZZ\: enable check_for_inline/) {
1044 if ($disable == 0 and m/^\s*inline/) {
1045 print_error
("$file:$.: 'inline' keyword found");
1051 print STDERR
"Error: Could not open $file\n";
1057 # This test checks for the inclusion of math.h. math.h should be avoided
1058 # since on some platforms, "exceptions" is defined as a struct, which will
1059 # cause problems with exception handling
1060 sub check_for_math_include
()
1062 return if is_suppressed
();
1064 print "Running math.h test\n";
1065 foreach $file (@files_h, @files_cpp, @files_inl) {
1066 if (open (FILE
, $file)) {
1068 print "Looking at file $file\n" if $opt_d;
1070 if (/FUZZ\: disable check_for_math_include/) {
1073 if (/FUZZ\: enable check_for_math_include/) {
1077 and /^\s*#\s*include\s*(\/\
*\
*\
/){0,1}\s*\<math\.h\>/) {
1078 print_error
("$file:$.: <math.h> included");
1084 print STDERR
"Error: Could not open $file\n";
1089 # This test checks for the inclusion of streams.h.
1090 # // FUZZ: disable check_for_streams_include
1091 sub check_for_streams_include
()
1093 return if is_suppressed
();
1095 print "Running ace/streams.h test\n";
1096 foreach $file (@files_h, @files_cpp, @files_inl) {
1097 if (open (FILE
, $file)) {
1099 print "Looking at file $file\n" if $opt_d;
1101 if (/FUZZ\: disable check_for_streams_include/) {
1104 if (/FUZZ\: enable check_for_streams_include/) {
1108 and /^\s*#\s*include\s*\"ace\/streams\
.h
\"/) {
1109 print_error
("$file:$.: expensive ace/streams.h included; consider ace/iosfwd.h");
1110 print " ace/streams.h is very expensive in both ";
1111 print "compile-time and footprint. \n";
1112 print " Please consider including ace/iosfwd.h instead.\n\n";
1118 print STDERR
"Error: Could not open $file\n";
1123 # This test checks for the inclusion of Synch*.h.
1124 sub check_for_synch_include
()
1126 return if is_suppressed
();
1128 print "Running ace/Synch*.h test\n";
1129 foreach $file (@files_h, @files_cpp, @files_inl) {
1130 if (open (FILE
, $file)) {
1132 print "Looking at file $file\n" if $opt_d;
1134 if (/FUZZ\: disable check_for_synch_include/) {
1137 if (/FUZZ\: enable check_for_synch_include/) {
1141 and (/^\s*#\s*include\s*\"(ace\/Synch\
.h
)\"/
1142 or /^\s*#\s*include\s*\"(ace\/Synch_T\
.h
)\"/)) {
1144 print_error
("$file:$.: expensive $synch included; consider individual synch file");
1145 print " $synch is very expensive in both ";
1146 print "compile-time and footprint. \n";
1147 print " Please consider including one of the ";
1148 print "individual synch files instead.\n\n";
1154 print STDERR
"Error: Could not open $file\n";
1159 # For general readability, lines should not contain more than 80 characters
1160 sub check_for_line_length
()
1162 return if is_suppressed
();
1164 print "Running line length test\n";
1165 foreach $file (@files_h, @files_cpp, @files_inl) {
1166 if (open (FILE
, $file)) {
1167 print "Looking at file $file\n" if $opt_d;
1170 # Make sure to ignore ACE_RCSID lines, since they
1171 # are difficult to get under 80 chars.
1172 if (/.{80,}/ and !/^ACE_RCSID/) {
1173 print_error
("$file:$.: line longer than 80 chars");
1179 print STDERR
"Error: Could not open $file\n";
1185 # For preprocessor directives, only the old C style comments (/* */)
1186 # should be used, not the newer // style.
1187 sub check_for_preprocessor_comments
()
1189 return if is_suppressed
();
1191 print "Running preprocessor comment test\n";
1192 foreach $file (@files_h, @files_cpp, @files_inl) {
1193 if (open (FILE
, $file)) {
1194 print "Looking at file $file\n" if $opt_d;
1197 print_error
("$file:$.: C++ comment in directive");
1203 print STDERR
"Error: Could not open $file\n";
1208 # We should not have empty files in the repo
1209 sub check_for_empty_files
()
1211 return if is_suppressed
();
1213 print "Running empty file test\n";
1214 foreach $file (@files_inl, @files_cpp, @files_rb) {
1215 my $found_non_empty_line = 0;
1216 if (open (FILE
, $file)) {
1217 print "Looking at file $file\n" if $opt_d;
1219 next if /^[[:blank:]]*$/; # skip empty lines
1220 next if /^[[:blank:]]*\/\
//; # skip C++ comments
1221 next if /^[[:blank:]]*\/\
*/; # skip C++ comments
1222 $found_non_empty_line = 1;
1226 if ($found_non_empty_line == 0) {
1227 print_error
("$file:1: empty file should not be in the repository");
1231 print STDERR
"Error: Could not open $file\n";
1237 # This test checks for the use of the Win32 Unicode string defines
1238 # or outdated ASYS_* macros
1239 # We should only be using the ACE_TCHAR, ACE_TEXT macros instead.
1242 return if is_suppressed
();
1244 print "Running TCHAR test\n";
1245 foreach $file (@files_h, @files_cpp, @files_inl) {
1246 if (open (FILE
, $file)) {
1248 print "Looking at file $file\n" if $opt_d;
1250 if (/FUZZ\: disable check_for_tchar/) {
1253 if (/FUZZ\: enable check_for_tchar/) {
1256 if ($disable == 0) {
1258 print_error
("$file:$.: LPTSTR found");
1262 print_error
("$file:$.: LPCTSTR found");
1266 print_error
("$file:$.: ASYS_TCHAR found");
1268 elsif (/TCHAR/ and !/ACE_TCHAR/) {
1269 ### Do a double check, since some macros do have TCHAR
1270 ### (like DEFAULTCHARS)
1271 if (/^TCHAR[^\w_]/ or /[^\w_]TCHAR[^\w_]/) {
1272 print_error
("$file:$.: TCHAR found");
1277 print_error
("$file:$.: ASYS_TEXT found");
1279 elsif (/TEXT/ and !/ACE_TEXT/) {
1280 ### Do a double check, since there are several macros
1281 ### that end with TEXT
1282 if (/^TEXT\s*\(/ or /[^\w_]TEXT\s*\(/) {
1283 print_error
("$file:$.: TEXT found");
1291 print STDERR
"Error: Could not open $file\n";
1296 # This checks to see if Makefiles define a DEPENDENCY_FILE, and if they do
1297 # whether or not it's in the cvs repo.
1298 sub check_for_dependency_file
()
1300 return if is_suppressed
();
1302 print "Running DEPENDENCY_FILE test\n";
1303 foreach $file (@files_makefile) {
1304 if (open (FILE
, $file)) {
1305 print "Looking at file $file\n" if $opt_d;
1307 if (/^DEPENDENCY_FILE\s* =\s*(.*)/) {
1310 $path =~ s/\/GNUmakefile.*/\
//;
1311 $depend = $path . $depend;
1312 unless (open (DFILE
, $depend)) {
1313 print_error
("DEPENDENCY_FILE \"$depend\" not found");
1314 print " Either add \"$depend\" to git ";
1315 print "or remove DEPENDENCY_FILE variable\n";
1316 print " from $file\n\n";
1324 print_error
("cannot open $file");
1329 # This checks to see if GNUmakefiles define a MAKEFILE, and if it matches the
1330 # name of the GNUmakefile
1331 sub check_for_makefile_variable
()
1333 return if is_suppressed
();
1335 print "Running MAKEFILE variable test\n";
1336 foreach $file (@files_makefile) {
1337 if (!(substr($file,-4) eq ".bor")
1338 and !(substr($file,-3) eq ".am")
1339 and !(substr($file,-4) eq ".vac")
1340 and !(substr($file,-4) eq ".alt")) {
1341 if (open (FILE
, $file)) {
1342 print "Looking at file $file\n" if $opt_d;
1343 my $makevarfound = 0;
1344 my $filename = basename
($file,"");
1346 if (/^MAKEFILE\s*=\s*(.*)/) {
1349 if (!($makevar eq $filename)) {
1350 print_error
("$file:$.: MAKEFILE variable $makevar != $filename");
1351 print " Change MAKEFILE = $filename in $file.\n\n";
1355 if ($makevarfound == 0 and !($filename eq "GNUmakefile")) {
1356 print_error
("$file:$.: MAKEFILE variable missing in $file");
1357 print " Add MAKEFILE = $filename to the top of $file.\n\n";
1362 print_error
("cannot open $file");
1369 # This checks to make sure files include ace/post.h if ace/pre.h is included
1371 sub check_for_pre_and_post
()
1373 return if is_suppressed
();
1375 print "Running pre.h/post.h test\n";
1376 foreach $file (@files_h) {
1379 if (open (FILE
, $file)) {
1381 print "Looking at file $file\n" if $opt_d;
1383 if (/FUZZ\: disable check_for_pre_and_post/) {
1386 if (/FUZZ\: enable check_for_pre_and_post/) {
1389 if ($disable == 0) {
1390 if (/^\s*#\s*include\s*\"ace\/pre\
.h
\"/) {
1391 print_error
("$file:$.: pre.h missing \"/**/\"");
1394 if (/^\s*#\s*include\s*\s*\"ace\/post\
.h
\"/) {
1395 print_error
("$file:$.: post.h missing \"/**/\"");
1398 if (/^\s*#\s*include\s*\/\
*\
*\
/\s*\"ace\/pre\
.h
\"/) {
1401 if (/^\s*#\s*include\s*\/\
*\
*\
/\s*\"ace\/post\
.h
\"/) {
1408 if ($disable == 0 && $pre != $post) {
1409 print_error
("$file:1: pre.h/post.h mismatch");
1413 print STDERR
"Error: Could not open $file\n";
1418 # This test verifies that the same number of "#pragma warning(push)" and
1419 # "#pragma warning(pop)" pragmas are used in a given header.
1420 sub check_for_push_and_pop
()
1422 return if is_suppressed
();
1424 print "Running #pragma (push)/(pop) test\n";
1425 foreach $file (@files_h) {
1428 if (open (FILE
, $file)) {
1430 print "Looking at file $file\n" if $opt_d;
1432 if (/FUZZ\: disable check_for_push_and_pop/) {
1435 if (/FUZZ\: enable check_for_push_and_pop/) {
1438 if ($disable == 0) {
1439 if (/^\s*#\s*pragma\s*warning\s*\(\s*push[,1-4]*\s*\)/) {
1442 if (/^\s*#\s*pragma\s*warning\s*\(\s*pop\s*\)/) {
1449 if ($disable == 0 && $push_count != $pop_count) {
1450 print_error
("$file: #pragma warning(push)/(pop) mismatch");
1454 print STDERR
"Error: Could not open $file\n";
1459 # This test verifies that the same number of
1460 # "ACE_VERSIONED_NAMESPACE_BEGIN_DECL" and
1461 # "ACE_END_VERSIONED_NAMESPACE_DECL" macros are used in a given
1463 sub check_for_versioned_namespace_begin_end
()
1465 return if is_suppressed
();
1467 print "Running versioned namespace begin/end test\n";
1468 foreach $file (@files_cpp, @files_inl, @files_h) {
1469 my $begin_count = 0;
1471 if (open (FILE
, $file)) {
1472 print "Looking at file $file\n" if $opt_d;
1474 if (/^\s*\w+_BEGIN_VERSIONED_NAMESPACE_DECL/) {
1477 if (/^\s*\w+_END_VERSIONED_NAMESPACE_DECL/) {
1480 if ($begin_count > $end_count and
1481 /^\s*#\s*include(\s*\/\
*\
*\
/)?\s*"/) {
1482 print_error
("$file:$.: #include directive within Versioned namespace block");
1488 if ($begin_count != $end_count) {
1489 print_error
("$file: Versioned namespace begin($begin_count)/end($end_count) mismatch");
1493 print STDERR
"Error: Could not open $file\n";
1499 # Check doxygen @file comments
1500 sub check_for_mismatched_filename
()
1502 return if is_suppressed
();
1504 print "Running doxygen \@file test\n";
1505 foreach $file (@files_h, @files_cpp, @files_inl, @files_idl) {
1506 if (open (FILE
, $file)) {
1508 print "Looking at file $file\n" if $opt_d;
1510 if (m/\@file\s*([^\s]+)/){
1511 # $file includes complete path, $1 is the name after
1512 # @file. We must check whether the last part of $file
1514 if ($file !~ /$1$/) {
1515 print_error
("$file:$.: \@file mismatch in $file, found $1");
1522 print STDERR
"Error: Could not open $file\n";
1527 # check for bad run_test
1528 sub check_for_bad_run_test
()
1530 return if is_suppressed
();
1532 print "Running run_test.pl test\n";
1533 foreach $file (@files_run_pl) {
1534 if (open (FILE
, $file)) {
1535 my $is_run_test = 0;
1538 if (($file =~ /.*TAO\/examples\
/Advanced.*/)) {
1541 if (($file =~ /.*TAO\/orbsvcs\
/examples\/Security\
/Send_File.*/)) {
1545 print "Looking at file $file\n" if $opt_d;
1548 if (m/PerlACE/ || m/ACEutils/) {
1552 if ($is_run_test == 1) {
1554 print_error
("$file:$.: ACEutils.pm still in use");
1557 if (m/unshift \@INC/) {
1558 print_error
("$file:$.: unshifting \@INC; use \"use lib\"");
1561 if (m/\$EXEPREFIX/) {
1562 print_error
("$file:$.: using \$EXEPREFIX");
1566 print_error
("$file:$.: using \$EXE_EXT");
1569 if (m/Sys::Hostname/) {
1570 print_error
("$file:$.: using Sys::Hostname");
1573 if (m/PerlACE::wait_interval_for_process_creation/) {
1574 print_error
("$file:$.: using PerlACE::wait_interval_for_process_creation");
1577 if (m/PerlACE::waitforfile_timed/) {
1578 print_error
("$file:$.: using PerlACE::waitforfile_timed");
1581 if (m/PerlACE::is_vxworks_test/) {
1582 print_error
("$file:$.: using PerlACE::is_vxworks_test");
1585 if (m/PerlACE::add_lib_path/) {
1586 print_error
("$file:$.: using PerlACE::add_lib_path, use AddLibPath on the target");
1589 if (m/PerlACE::Run_Test/) {
1590 print_error
("$file:$.: using PerlACE::Run_Test, use PerlACE::TestTarget");
1593 if (m/PerlACE::random_port/) {
1594 print_error
("$file:$.: using PerlACE::random_port, use TestTarget::random_port");
1597 if (m/PerlACE::Process/) {
1598 print_error
("$file:$.: using PerlACE::Process");
1601 if (m/PerlACE::TestConfig/) {
1602 print_error
("$file:$.: using PerlACE::TestConfig");
1605 if (m/ACE_RUN_VX_TGTHOST/) {
1606 print_error
("$file:$.: using ACE_RUN_VX_TGTHOST, use TestTarget::HostName");
1609 if (m/Spawn(Wait(Kill)?)?\s*\(.+\->ProcessStop.*\)/) {
1610 print_error
("$file:$.: uses Stop together with Spawn");
1613 if (m/Spawn(Wait(Kill)?)?\s*\(\d+\)/) {
1614 print_error
("$file:$.: uses hardcoded timeout for Spawn");
1617 if (m/Kill\s*\(\d+\)/) {
1618 print_error
("$file:$.: uses hardcoded timeout for Kill");
1622 print_error
("$file:$.: using unlink");
1625 if (m/PerlACE::LocalFile/) {
1626 print_error
("$file:$.: using PerlACE::LocalFile");
1629 if (m/\$DIR_SEPARATOR/) {
1630 print_error
("$file:$.: using \$DIR_SEPARATOR");
1632 if (m/ACE\:\:/ && !m/PerlACE\:\:/) {
1633 print_error
("$file:$.: using ACE::*");
1636 if (m/Process\:\:/ && !m/PerlACE\:\:Process\:\:/) {
1637 print_error
("$file:$.: using Process::*");
1640 if (m/Process\:\:Create/) {
1641 print_error
("$file:$.: using Process::Create");
1645 print_warning
("$file:$.: using two-space indentation");
1649 print_error
("$file:$.: Indenting using tabs");
1652 if (m/^\s*\{/ && $sub != 1) {
1653 print_warning
("$file:$.: Using Curly Brace alone");
1656 if (m/timedout/i && !m/\#/) {
1657 print_error
("$file:$.: timedout message found");
1672 my @output = `perl -wc $file 2>&1`;
1674 foreach $output (@output) {
1676 if ($output =~ m/error/i) {
1677 print_error
($output);
1679 elsif ($output !~ m/syntax OK/) {
1680 print_warning
($output);
1689 # Check for links to ~schmidt/ACE_wrappers/, which should not be in the
1691 sub check_for_absolute_ace_wrappers
()
1693 return if is_suppressed
();
1695 print "Running absolute ACE_wrappers test\n";
1696 foreach $file (@files_html) {
1697 if (open (FILE
, $file)) {
1698 print "Looking at file $file\n" if $opt_d;
1700 if (m/\~schmidt\/ACE_wrappers\
//) {
1702 print_error
("$file:$.: ~schmidt/ACE_wrappers found");
1709 print STDERR
"Error: Could not open $file\n";
1714 # Check for generated headers in the code documentation
1715 sub check_for_generated_headers
()
1717 return if is_suppressed
();
1719 print "Running generated headers test\n";
1720 foreach $file (@files_cpp, @files_inl, @files_h) {
1721 if (open (FILE
, $file)) {
1722 print "Looking at file $file\n" if $opt_d;
1724 if (m/Code generated by the The ACE ORB \(TAO\) IDL Compiler/) {
1726 print_error
("$file:$.: header found");
1733 print STDERR
"Error: Could not open $file\n";
1738 # Make sure ACE_[OS_]TRACE matches the function/method
1739 sub check_for_bad_ace_trace
()
1741 return if is_suppressed
();
1743 print "Running TRACE test\n";
1744 foreach $file (@files_inl, @files_cpp) {
1745 if (open (FILE
, $file)) {
1749 print "Looking at file $file\n" if $opt_d;
1752 # look for methods or functions
1753 if (m/(^[^\s][^\(]*)\:\:([^\:^\(]*[^\s^\(])\s*/) {
1757 elsif (m/^([^\s^\(^\#]*) \(/i) {
1761 elsif (m/^(operator.*) \(/i) {
1765 elsif (m/^class (.*)\s*:/) {
1769 elsif (m/^class (.*)\s*$/) {
1774 # print "TRACE_CHECK. Class = $class\n";
1776 # Look for TRACE statements
1777 if (m/ACE_OS_TRACE\s*\(\s*\"(.*)\"/
1778 || m/ACE_TRACE\s*\(\s*\"(.*)\"/) {
1781 # reduce the classname
1782 if ($class =~ m/([^\s][^\<^\s]*)\s*\</) {
1786 # print "TRACE_CHECK. Found a trace. Class = $class\n";
1788 if ($class =~ m/([^\s^\&^\*]*)\s*$/) {
1792 # print "TRACE_CHECK. Augmenting class. Class = $class\n";
1794 if ($trace !~ m/\Q$function\E/
1795 || ($trace =~ m/\:\:/ && !($trace =~ m/\Q$class\E/ && $trace =~ m/\Q$function\E/))) {
1796 print_error
("$file:$.: Mismatched TRACE");
1797 print_error
("$file:$.: I see \"$trace\" but I think I'm in \""
1798 . $class . "::" . $function . "\"");
1805 print STDERR
"Error: Could not open $file\n";
1810 sub check_for_deprecated_macros
()
1812 return if is_suppressed
();
1814 ## Take the current working directory and remove everything up to
1815 ## ACE_wrappers (or ACE for the peer-style checkout). This will be
1816 ## used to determine when the use of ACE_THROW_SPEC is an error.
1817 my($cwd) = getcwd
();
1818 if ($cwd =~ s/.*(ACE_wrappers)/$1/) {
1820 elsif ($cwd =~ s/.*(ACE)/$1/) {
1823 print "Running deprecated macros check\n";
1824 foreach $file (@files_cpp, @files_inl, @files_h) {
1825 if (open (FILE
, $file)) {
1827 print "Looking at file $file\n" if $opt_d;
1829 if (/ACE_THROW_SPEC/) {
1830 ## Do not use ACE_THROW_SPEC in TAO.
1831 if ($file =~ /TAO/i || $cwd =~ /TAO/i) {
1832 print_error
("$file:$.: ACE_THROW_SPEC found.");
1839 print STDERR
"Error: Could not open $file\n";
1843 # This test checks for ptr_arith_t usage in source code. ptr_arith_t
1844 # is non-portable. Use ptrdiff_t instead.
1845 sub check_for_ptr_arith_t
()
1847 return if is_suppressed
();
1849 print "Running ptr_arith_t check\n";
1850 foreach $file (@files_cpp, @files_inl, @files_h) {
1851 if (open (FILE
, $file)) {
1853 print "Looking at file $file\n" if $opt_d;
1856 next if m/^\s*\/\
//; # Ignore C++ comments.
1857 next if m/^\s*$/; # Skip lines only containing
1860 # Check for ptr_arith_t usage. This test should
1861 # ignore typedefs, and should only catch variable
1862 # declarations and parameter types.
1863 if (m/ptr_arith_t / || m/ptr_arith_t,/) {
1864 print_error
("$file:$.: ptr_arith_t; use ptrdiff_t instead.");
1870 print STDERR
"Error: Could not open $file\n";
1875 # This test checks for the #include <ace/...>
1876 # This check is suggested by Don Hinton to force user to use
1877 # " " instead of <> to avoid confict with Doxygen.
1878 sub check_for_include
()
1880 return if is_suppressed
();
1882 print "Running the include check\n";
1883 foreach $file (@files_h, @files_cpp, @files_inl, @files_idl) {
1884 my $bad_occurance = 0;
1885 if (open (FILE
, $file)) {
1887 print "Looking at file $file\n" if $opt_d;
1889 if (/FUZZ\: disable check_for_include/) {
1892 if (/FUZZ\: enable check_for_include/) {
1895 if ($disable == 0) {
1896 if (/^\s*#\s*include\s*<[(ace)|(TAO)]\/.*>/) {
1897 print_error
("$file:$.: include <ace\/..> used");
1900 if (/^\s*#\s*include\s*<tao\/.*>/) {
1901 print_error
("$file:$.: include <tao\/..> used");
1908 if ($disable == 0 && $bad_occurance > 0 ) {
1909 print_error
("$file:1: found $bad_occurance usage(s) of #include <> of ace\/tao.");
1913 print STDERR
"Error: Could not open $file\n";
1918 # This test verifies that all equality, relational and logical
1919 # operators return bool, as is the norm for modern C++.
1921 # NOTE: This test isn't fool proof yet.
1922 sub check_for_non_bool_operators
()
1924 return if is_suppressed
();
1926 print "Running non-bool equality, relational and logical operator check\n";
1927 foreach $file (@files_h, @files_inl, @files_cpp) {
1928 if (open (FILE
, $file)) {
1929 print "Looking at file $file\n" if $opt_d;
1931 my $found_return_type = 0;
1934 if ($found_bool == 0
1939 || /[^\w]return\s*$/))
1942 $found_return_type = 0;
1946 if ($found_bool == 0 && $found_return_type == 0
1947 && /^(?:\w+|\s+\w+)\s*$/
1948 && !/[^\w]return\s*$/)
1950 $found_return_type = 1;
1955 if ($found_bool == 0
1956 && /(?<![^\w]bool)(\s+|\w+::|>\s*::)operator\s*(?:!|<|<=|>|>=|==|!=|&&|\|\|)\s*\(/
1957 && !/\(.*operator\s*(?:!|<|<=|>|>=|==|!=|&&|\|\|)\s*\(/
1958 && !/^\s*return\s+/) {
1959 print_error
("$file:$.: non-bool return type for operator");
1962 $found_return_type = 0;
1968 print STDERR
"Error: Could not open $file\n";
1973 # This test verifies that all filenames are short enough
1974 sub check_for_long_file_names
()
1976 return if is_suppressed
();
1978 my $max_filename = 50;
1979 my $max_mpc_projectname = $max_filename - 12; ## GNUmakefile.[project_name]
1980 print "Running file names check\n";
1982 foreach $file (@files_cpp, @files_inl, @files_h, @files_html,
1983 @files_dsp, @files_dsw, @files_gnu, @files_idl,
1984 @files_pl, @files_changelog, @files_makefile,
1985 @files_bor, @files_mpc, @files_generic) {
1986 if ( length( basename
($file) ) >= $max_filename )
1988 print_error
("File name $file meets or exceeds $max_filename chars.");
1991 foreach $file (grep(/\.mpc$/, @files_mpc)) {
1992 if (open(FH
, $file)) {
1993 my($blen) = length(basename
($file)) - 4; ## .mpc
1995 if (/project\s*(:.*)\s*{/) {
1996 if ($blen >= $max_mpc_projectname) {
1997 print_warning
("File name $file meets or exceeds $max_mpc_projectname chars.");
2000 elsif (/project\s*\(([^\)]+)\)/) {
2002 if ($name =~ /\*/) {
2003 my($length) = length($name) + (($name =~ tr/*//) * $blen);
2004 if ($length >= $max_mpc_projectname) {
2005 print_warning
("Project name ($name) from $file will meet or exceed $max_mpc_projectname chars when expanded by MPC.");
2009 if (length($name) >= $max_mpc_projectname) {
2010 print_warning
("Project name ($name) from $file meets or exceeds $max_mpc_projectname chars.");
2020 sub check_for_refcountservantbase
()
2022 return if is_suppressed
();
2024 print "Running PortableServer::RefCountServantBase derivation check\n";
2026 foreach $file (@files_h, @files_cpp, @files_inl) {
2027 if (open (FILE
, $file)) {
2028 print "Looking at file $file\n" if $opt_d;
2031 if (/PortableServer::RefCountServantBase/) {
2032 print_error
("$file:$.: reference to deprecated PortableServer::RefCountServantBase");
2038 print STDERR
"Error: Could not open $file\n";
2043 sub check_for_old_documentation_style
()
2045 return if is_suppressed
();
2047 print "Running documentation style check\n";
2049 foreach $file (@files_h, @files_cpp, @files_inl) {
2050 if (open (FILE
, $file)) {
2051 print "Looking at file $file\n" if $opt_d;
2054 if (/\/\
/\s*\= TITLE/) {
2055 print_error
("$file:$.: found old documentation style // = TITLE");
2061 print STDERR
"Error: Could not open $file\n";
2066 sub check_for_TAO_Local_RefCounted_Object
()
2068 return if is_suppressed
();
2070 print "Running TAO_Local_RefCounted_Object check\n";
2072 ITERATION
: foreach $file (@files_h, @files_cpp, @files_inl) {
2073 if (open (FILE
, $file)) {
2075 print "Looking at file $file\n" if $opt_d;
2077 if (/FUZZ\: disable check_for_TAO_Local_RefCounted_Object/) {
2080 if (/FUZZ\: enable check_for_TAO_Local_RefCounted_Object/) {
2084 if ($disable == 0 and /TAO_Local_RefCounted_Object/) {
2085 print_error
("$file:$.: TAO_Local_RefCounted_Object is deprecated, use CORBA::LocalObject instead");
2091 print STDERR
"Error: Could not open $file\n";
2096 # This test checks for the correct use of ORB_init() so as
2097 # to be compatible with wide character builds.
2098 sub check_for_ORB_init
()
2100 return if is_suppressed
();
2102 print "Running the ORB_init() wide character incompatibility check\n";
2103 foreach $file (@files_cpp, @files_inl) {
2104 if (open (FILE
, $file)) {
2107 my $not_found_end_line_count= 0;
2108 print "Looking at file $file\n" if $opt_d;
2110 if (!defined $multi_line) {
2111 if (/FUZZ\: disable check_for_ORB_init/) {
2115 elsif (/FUZZ\: enable check_for_ORB_init/) {
2119 elsif ($disable == 0) {
2120 s/^\s+//; ## Remove leading space
2121 s/\s*(\/\/.*)?
$//; ## Remove trailling space and line comments
2122 if (s/^([^=]*=)?\s*(CORBA\s*::\s*)?ORB_init\s*//) {
2123 $multi_line = $_; ## Rest of the line
2131 $_ =~ s/^\s+//; ## Remove leading space
2132 $_ =~ s/\s*(\/\/.*)?
$//; ## Remove trailling space and line comments
2133 if ($multi_line eq "") { ## Append this line to existing statement.
2137 $multi_line .= ' ' . $_;
2140 my $testing = $multi_line;
2141 if ($testing =~ s/^\(([^\"\/\)]*(\"([^\"\\]*(\\.)*)\")?(\/+\
*.*?\
*\
/\s*)*)*\)//) {
2142 # $testing has thrown away what we actually want, i.e.
2143 # we want to ignore what's left in $testing.
2145 $multi_line = substr ($multi_line, 0, -length ($testing));
2146 $multi_line =~ s!/\*.*?\*/! !g; ## Remove any internal /* ... */ comments
2147 $multi_line =~ s!\s{2,}! !g; ## collapse multi spaces
2148 $multi_line =~ s/^\(\s*//; ## Trim leading ( and space
2149 $multi_line =~ s/\s*\)$//; ## Trim trailing space and )
2151 if ($multi_line =~ s/^[^,]*,\s*//) { # If this fails there is only 1 parameter (which we will ignore)
2152 # 1st parameter has been removed by the above, split up remaining 2 & 3
2153 $multi_line =~ s/^([^,]*),?\s*//;
2155 $param2 =~ s/\s+$//; # Trim trailing spaces
2157 print_error
("$file:$.: ORB_init() 2nd parameter requires static_cast<ACE_TCHAR **>(0)") if ($param2 eq '0');
2158 print_error
("$file:$.: ORB_init() 3rd parameter is redundant (default orbID or give as string)") if ($multi_line eq '0');
2159 print_error
("$file:$.: ORB_init() 3rd parameter is redundant (default orbID already \"\")") if ($multi_line eq '""');
2163 $not_found_end_line_count = 0;
2165 elsif ($not_found_end_line_count < 10) { # Limit the search for ( ... ) following ORB_init to ten lines
2166 ++$not_found_end_line_count;
2170 $not_found_end_line_count = 0;
2176 print STDERR
"Error: Could not open $file\n";
2181 # This test checks for the presence of an include for ace/OS.h
2182 # which should never occur. Only user code is allowed to include OS.h.
2183 sub check_for_include_OS_h
()
2185 return if is_suppressed
();
2187 print "Running the OS.h inclusion check\n";
2188 foreach $file (@files_h, @files_cpp, @files_inl) {
2189 if (open (FILE
, $file)) {
2191 print "Looking at file $file\n" if $opt_d;
2193 if (/FUZZ\: disable check_for_include_OS_h/) {
2197 elsif (/FUZZ\: enable check_for_include_OS_h/) {
2201 elsif ($disable == 0 and /^\s*#\s*include\s*<[(ace)|(TAO)]\/.*>/) {
2202 print_error
("$file:$.: include <ace\/..> used");
2205 if ($disable == 0 and /^\s*#\s*include\s*"ace\/OS
.h
"/) {
2206 print_error ("$file:$.: include ace
/OS
.h used
");
2213 print STDERR "Error
: Could
not open $file\n";
2218 sub check_for_ace_log_categories ()
2220 return if is_suppressed ();
2222 print "Running the ACE
log categories check
\n";
2224 my @macros = qw/HEX_DUMP ERROR ERROR_RETURN ERROR_BREAK DEBUG/;
2225 my $macros = join ('|', @macros);
2227 for my $f (@files_h, @files_cpp, @files_inl) {
2230 if ($f =~ /\bace\/(\w+)/) {
2231 next if $1 eq 'Log_Msg' || $` =~ /\/protocols\/$/;
2234 elsif ($f =~ /tao\// && $f !~ /interop-tests\//) {
2237 elsif ($f =~ /\/orbsvcs\// && $f !~ /tests|examples/i) {
2240 elsif ($f =~ /tests\/Log_Msg_Test\.cpp/) {
2244 if (open (IN, $f)) {
2245 print "Looking at file
$f for category
$cat\n" if $opt_d;
2248 if (/FUZZ: disable check_for_ace_log_categories/) {
2252 elsif (/FUZZ: enable check_for_ace_log_categories/) {
2256 elsif ($disable == 0
2257 && /\b(ACE|ACELIB|TAOLIB|ORBSVCS)_($macros)\b/g
2259 print_error ("$f:$.: found
log macro
$1_$2, "
2260 . "expecting
${cat
}_
$2");
2266 print STDERR "Error
: Could
not open $f\n";
2272 ##############################################################################
2274 use vars qw/$opt_c $opt_d $opt_x $opt_h $opt_l $opt_t $opt_s $opt_m/;
2276 if (!getopts ('cdx:hl:t:s:mv') || $opt_h) {
2277 print "fuzz
.pl
[-cdhm
] [-l level
] [-t test_names
] [file1
, file2
, ...]\n";
2279 print " -c only look at the files passed
in\n";
2280 print " -d turn on debugging
\n";
2281 print " -x specify comma
-separated list of path masks
\n";
2282 " (regex
) to exclude
\n";
2283 print " -h display this help
\n";
2284 print " -l level set detection level
(default = 5)\n";
2285 print " -t test_names specify comma
-separated list of tests to run
\n".
2286 " this will disable the run level setting
\n";
2287 print " -s test_names specify comma
-separated list of tests to suppress
\n".
2288 " this will supplement the run level setting
\n";
2289 print " -m only check locally modified files
(uses git
)\n";
2290 print "======================================================\n";
2291 print "list of the tests that could be run
or suppressed
:\n";
2293 check_for_noncvs_files
2294 check_for_generated_headers
2295 check_for_synch_include
2296 check_for_streams_include
2297 check_for_dependency_file
2298 check_for_makefile_variable
2299 check_for_inline_in_cpp
2302 check_for_ACE_SYNCH_MUTEX
2303 check_for_ACE_Thread_Mutex
2305 check_for_exception_spec
2307 check_for_improper_main_declaration
2308 check_for_lack_ACE_OS
2310 check_for_math_include
2311 check_for_line_length
2312 check_for_preprocessor_comments
2314 check_for_pre_and_post
2315 check_for_push_and_pop
2316 check_for_versioned_namespace_begin_end
2317 check_for_mismatched_filename
2318 check_for_bad_run_test
2319 check_for_absolute_ace_wrappers
2320 check_for_bad_ace_trace
2321 check_for_ptr_arith_t
2322 check_for_include (disabled by default)
2323 check_for_non_bool_operators
2324 check_for_long_file_names
2325 check_for_refcountservantbase
2326 check_for_TAO_Local_RefCounted_Object
2328 check_for_trailing_whitespace
2329 check_for_include_OS_h
2331 check_for_old_documentation_style
2332 check_for_ace_log_categories
2341 # Before opt_m is read!
2343 my @excludes = split '\s*,\s*', $opt_x;
2344 for my $exclude (@excludes) {
2345 push (@excluded_dirs, $exclude);
2350 foreach $file (@ARGV) {
2362 my @tests = split '\s*,\s*', $opt_t;
2363 for my $test (@tests) {
2366 print "\nfuzz.pl - $errors error(s), $warnings warning(s)\n";
2367 exit ($errors > 0) ?
1 : 0;
2371 my @tests = split '\s*,\s*', $opt_s;
2372 for my $test (@tests) {
2373 $suppressed_tests{$test} = 1;
2377 print "--------------------Configuration: Fuzz - Level ",$opt_l,
2378 "--------------------\n";
2380 check_for_trailing_whitespace
() if ($opt_l >= 4);
2381 check_for_lack_ACE_OS
() if ($opt_l >= 6);
2382 check_for_ACE_Guard
() if ($opt_l >= 1);
2383 check_for_generated_headers
() if ($opt_l >= 6);
2384 check_for_bad_run_test
() if ($opt_l >= 5);
2385 check_for_deprecated_macros
() if ($opt_l >= 1);
2386 check_for_refcountservantbase
() if ($opt_l >= 1);
2387 check_for_msc_ver_string
() if ($opt_l >= 3);
2388 check_for_empty_files
() if ($opt_l >= 1);
2389 check_for_noncvs_files
() if ($opt_l >= 1);
2390 check_for_streams_include
() if ($opt_l >= 6);
2391 check_for_dependency_file
() if ($opt_l >= 1);
2392 check_for_makefile_variable
() if ($opt_l >= 1);
2393 check_for_inline_in_cpp
() if ($opt_l >= 2);
2394 check_for_id_string
() if ($opt_l >= 1);
2395 check_for_newline
() if ($opt_l >= 1);
2396 check_for_ACE_Thread_Mutex
() if ($opt_l >= 1);
2397 check_for_ACE_SYNCH_MUTEX
() if ($opt_l >= 1);
2398 check_for_tab
() if ($opt_l >= 1);
2399 check_for_exception_spec
() if ($opt_l >= 1);
2400 check_for_NULL
() if ($opt_l >= 1);
2401 check_for_inline
() if ($opt_l >= 2);
2402 check_for_math_include
() if ($opt_l >= 3);
2403 check_for_synch_include
() if ($opt_l >= 6);
2404 check_for_line_length
() if ($opt_l >= 8);
2405 check_for_preprocessor_comments
() if ($opt_l >= 7);
2406 check_for_tchar
() if ($opt_l >= 4);
2407 check_for_pre_and_post
() if ($opt_l >= 4);
2408 check_for_push_and_pop
() if ($opt_l >= 4);
2409 check_for_versioned_namespace_begin_end
() if ($opt_l >= 4);
2410 check_for_mismatched_filename
() if ($opt_l >= 2);
2411 check_for_absolute_ace_wrappers
() if ($opt_l >= 3);
2412 check_for_bad_ace_trace
() if ($opt_l >= 4);
2413 check_for_ptr_arith_t
() if ($opt_l >= 4);
2414 check_for_non_bool_operators
() if ($opt_l > 2);
2415 check_for_long_file_names
() if ($opt_l >= 1);
2416 check_for_improper_main_declaration
() if ($opt_l >= 1);
2417 check_for_TAO_Local_RefCounted_Object
() if ($opt_l >= 1);
2418 check_for_include_OS_h
() if ($opt_l >= 1);
2419 check_for_ORB_init
() if ($opt_l >= 1);
2420 check_for_old_documentation_style
() if ($opt_l >= 6);
2421 check_for_ace_log_categories
() if ($opt_l >= 5);
2423 print "\nfuzz.pl - $errors error(s), $warnings warning(s)\n";
2425 exit (1) if $errors > 0;