Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Author

anonymous

over 4 years ago

Language

C

Compiler

gcc 10.1.0

Options
Warnings
C11(GNU)
no pedantic
Raw compiler options
-Werror

Author

anonymous

over 4 years ago

$ gcc prog.c -Wall -Wextra -std=gnu11 -Werror
prog.c:2:2: error: stray '\343' in program
    2 |   #include <stdio.h>
      |  ^~
prog.c:2:5: error: stray '#' in program
    2 |   #include <stdio.h>
      |    ^
prog.c:2:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    2 |   #include <stdio.h>
      |             ^
In file included from prog.c:3:
/usr/include/stdlib.h:865:20: error: unknown type name 'wchar_t'
  865 | extern int mbtowc (wchar_t *__restrict __pwc,
      |                    ^~~~~~~
/usr/include/stdlib.h:493:1: note: 'wchar_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
  492 | # include <alloca.h>
  +++ |+#include <stddef.h>
  493 | #endif /* Use misc.  */
/usr/include/stdlib.h:869:31: error: unknown type name 'wchar_t'
  869 | extern int wctomb (char *__s, wchar_t __wchar) __THROW;
      |                               ^~~~~~~
/usr/include/stdlib.h:869:31: note: 'wchar_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
/usr/include/stdlib.h:873:25: error: unknown type name 'wchar_t'
  873 | extern size_t mbstowcs (wchar_t *__restrict  __pwcs,
      |                         ^~~~~~~
/usr/include/stdlib.h:873:25: note: 'wchar_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
/usr/include/stdlib.h:877:10: error: unknown type name 'wchar_t'
  877 |    const wchar_t *__restrict __pwcs, size_t __n)
      |          ^~~~~~~
prog.c: In function 'search':
prog.c:42:5: error: 'else' without a previous 'if'
   42 |     else if (key < p->data) {
      |     ^~~~
prog.c:45:7: error: expected '}' before 'else'
   45 |       else
      |       ^~~~
prog.c: In function 'insert':
prog.c:74:5: error: expected '}' before 'else'
   74 |     else
      |     ^~~~
prog.c:82:32: error: lvalue required as left operand of assignment
   82 |   if((new=malloc(sizeof(NODE)))=NULL)
      |                                ^
prog.c: In function 'delete':
prog.c:123:8: error: implicit declaration of function 'deletemin'; did you mean 'delete'? [-Werror=implicit-function-declaration]
  123 |     *p=deletemin(&x->right);
      |        ^~~~~~~~~
      |        delete
prog.c:123:7: error: assignment to 'NODE *' {aka 'struct node *'} from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
  123 |     *p=deletemin(&x->right);
      |       ^
prog.c:124:17: error: lvalue required as left operand of assignment
  124 |     &(*p)->right=x->right;
      |                 ^
prog.c:125:16: error: lvalue required as left operand of assignment
  125 |     &(*p)->left=x->left;
      |                ^
prog.c: At top level:
prog.c:147:7: error: conflicting types for 'deletemin'
  147 | NODE *deletemin(NODE **p)
      |       ^~~~~~~~~
prog.c:123:8: note: previous implicit declaration of 'deletemin' was here
  123 |     *p=deletemin(&x->right);
      |        ^~~~~~~~~
prog.c: In function 'deletemin':
prog.c:151:2: error: this 'while' clause does not guard... [-Werror=misleading-indentation]
  151 |  while ((*p)->left != NULL)
      |  ^~~~~
prog.c:153:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
  153 |   x=*p;
      |   ^
prog.c: At top level:
prog.c:159:1: error: return type defaults to 'int' [-Werror=implicit-int]
  159 | preorder(NODE *p)
      | ^~~~~~~~
prog.c: In function 'preorder':
prog.c:163:2: error: 'return' with no value, in function returning non-void [-Werror=return-type]
  163 |  return;
      |  ^~~~~~
prog.c:159:1: note: declared here
  159 | preorder(NODE *p)
      | ^~~~~~~~
prog.c: At top level:
prog.c:175:1: error: return type defaults to 'int' [-Werror=implicit-int]
  175 | inorder(NODE *p)
      | ^~~~~~~
prog.c: In function 'inorder':
prog.c:179:2: error: 'return' with no value, in function returning non-void [-Werror=return-type]
  179 |  return;
      |  ^~~~~~
prog.c:175:1: note: declared here
  175 | inorder(NODE *p)
      | ^~~~~~~
prog.c: At top level:
prog.c:188:1: error: return type defaults to 'int' [-Werror=implicit-int]
  188 | postorder(NODE *p)
      | ^~~~~~~~~
prog.c: In function 'postorder':
prog.c:192:2: error: 'return' with no value, in function returning non-void [-Werror=return-type]
  192 |  return;
      |  ^~~~~~
prog.c:188:1: note: declared here
  188 | postorder(NODE *p)
      | ^~~~~~~~~
prog.c:194:2: error: implicit declaration of function 'postorderr'; did you mean 'postorder'? [-Werror=implicit-function-declaration]
  194 |  postorderr(p->left);  /* 左ノードへ移動 */
      |  ^~~~~~~~~~
      |  postorder
prog.c: In function 'main':
prog.c:223:2: error: too few arguments to function 'preorder'
  223 |  preorder();
      |  ^~~~~~~~
prog.c:159:1: note: declared here
  159 | preorder(NODE *p)
      | ^~~~~~~~
prog.c:228:2: error: too few arguments to function 'inorder'
  228 |  inorder();
      |  ^~~~~~~
prog.c:175:1: note: declared here
  175 | inorder(NODE *p)
      | ^~~~~~~
prog.c:233:2: error: too few arguments to function 'postorder'
  233 |  postorder();
      |  ^~~~~~~~~
prog.c:188:1: note: declared here
  188 | postorder(NODE *p)
      | ^~~~~~~~~
prog.c:245:4: error: stray '\343' in program
  245 |      delete(key2);
      |    ^~
prog.c:204:6: error: unused variable 'n' [-Werror=unused-variable]
  204 |  int n;
      |      ^
prog.c:203:6: error: unused variable 'i' [-Werror=unused-variable]
  203 |  int i;
      |      ^
cc1: all warnings being treated as errors
Exit Code:
1