Debian Codegraph @

gcc/testsuite/g++.dg/torture/pr55740.C

raw
1 // { dg-do compile }
2
3 static bool st_IsPathDelimiter( char c ) { return c == '/'; }
4 bool IsValidPath( char const * filename )
5 {
6 if ( !filename || filename[0] == 0 )
7 return false;
8 char const * run = filename;
9 while ( run && *run )
10 {
11 if ( run[0] == '.' )
12 if ( run[1] != '.' || ( !st_IsPathDelimiter( run[2] ) && run[2] != 0 ) )
13 return false;
14 while ( *run && !st_IsPathDelimiter( *run ) )
15 ++run;
16 if ( *run )
17 ++run;
18 }
19 } // { dg-warning "control reaches end of non-void function" }