接続数

COUNTER249001FROM 2012/5/16

MISRA-C diary(C言語日誌)

MISRA-C >> 記事詳細

2017/09/13

error compiler

Tweet ThisSend to Facebook | by kaizen
make
g++   -c -o interpreter.o interpreter.cc
interpreter.cc:109:13: warning: enumeration value 'Scond' not handled in switch [-Wswitch]
    switch ((*it)->getID())  {
            ^
1 warning generated.
g++   -c -o system.o system.cc
system.cc:6:17: warning: using directive refers to implicitly-defined namespace 'std'
using namespace std;
                ^
1 warning generated.
g++   -c -o symtable.o symtable.cc
symtable.cc:6:17: warning: using directive refers to implicitly-defined namespace 'std'
using namespace std;
                ^
symtable.cc:32:30: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
static char *pclassStr[] = { "関数", "コマンド" };
                             ^
symtable.cc:32:40: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
static char *pclassStr[] = { "関数", "コマンド" };
                                     ^
symtable.cc:217:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
symtable.cc:248:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
5 warnings generated.
g++   -I/usr/local/opt/llvm/include:/opt/X11/include  -c -o y.tab.o y.tab.c
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
tglc.y:2:17: warning: using directive refers to implicitly-defined namespace 'std'
using namespace std;
                ^
tglc.y:86:15: warning: 12 enumeration values not handled in switch: 'Cnot', 'Cmodulo', 'Cand'...
      [-Wswitch]
    { switch ((yyvsp[(2) - (3)].op))  {
              ^
tglc.y:90:15: warning: 11 enumeration values not handled in switch: 'Cnot', 'Cand', 'Cadd'...
      [-Wswitch]
    { switch ((yyvsp[(2) - (3)].op))  {
              ^
y.tab.c:1820:20: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
      yyerror (YY_("syntax error"));
                   ^
y.tab.c:239:22: note: expanded from macro 'YY_'
#  define YY_(msgid) msgid
                     ^
y.tab.c:1966:16: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
  yyerror (YY_("memory exhausted"));
               ^
y.tab.c:239:22: note: expanded from macro 'YY_'
#  define YY_(msgid) msgid
                     ^
tglc.y:254:1: error: C++ requires a type specifier for all declarations
main(int argc, char **argv)
^
5 warnings and 1 error generated.
<builtin>: recipe for target 'y.tab.o' failed
make: *** [y.tab.o] Error 1

---
#include <iostream>をccファイルに入れた
---
make
g++   -c -o system.o system.cc
g++   -c -o symtable.o symtable.cc
symtable.cc:33:30: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
static char *pclassStr[] = { "関数", "コマンド" };
                             ^
symtable.cc:33:40: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
static char *pclassStr[] = { "関数", "コマンド" };
                                     ^
symtable.cc:218:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
symtable.cc:249:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
4 warnings generated.
g++   -I/usr/local/opt/llvm/include:/opt/X11/include  -c -o y.tab.o y.tab.c
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
tglc.y:2:17: warning: using directive refers to implicitly-defined namespace 'std'
using namespace std;
                ^
tglc.y:86:15: warning: 12 enumeration values not handled in switch: 'Cnot', 'Cmodulo', 'Cand'...
      [-Wswitch]
    { switch ((yyvsp[(2) - (3)].op))  {
              ^
tglc.y:90:15: warning: 11 enumeration values not handled in switch: 'Cnot', 'Cand', 'Cadd'...
      [-Wswitch]
    { switch ((yyvsp[(2) - (3)].op))  {
              ^
y.tab.c:1820:20: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
      yyerror (YY_("syntax error"));
                   ^
y.tab.c:239:22: note: expanded from macro 'YY_'
#  define YY_(msgid) msgid
                     ^
y.tab.c:1966:16: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
  yyerror (YY_("memory exhausted"));
               ^
y.tab.c:239:22: note: expanded from macro 'YY_'
#  define YY_(msgid) msgid
                     ^
tglc.y:254:1: error: C++ requires a type specifier for all declarations
main(int argc, char **argv)
^
5 warnings and 1 error generated.
<builtin>: recipe for target 'y.tab.o' failed
make: *** [y.tab.o] Error 1

---
1)
tglc.lex
tglc.y

#include <iostream>

2) tglc.y
main(int argc, char **argv)

void main(int argc, char **argv)

--
 make
yacc -d -v tglc.y
g++   -I/usr/local/opt/llvm/include:/opt/X11/include  -c -o y.tab.o y.tab.c
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
tglc.y:88:15: warning: 12 enumeration values not handled in switch: 'Cnot', 'Cmodulo', 'Cand'...
      [-Wswitch]
    { switch ((yyvsp[(2) - (3)].op))  {
              ^
tglc.y:92:15: warning: 11 enumeration values not handled in switch: 'Cnot', 'Cand', 'Cadd'...
      [-Wswitch]
    { switch ((yyvsp[(2) - (3)].op))  {
              ^
y.tab.c:1822:20: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
      yyerror (YY_("syntax error"));
                   ^
y.tab.c:241:22: note: expanded from macro 'YY_'
#  define YY_(msgid) msgid
                     ^
y.tab.c:1968:16: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
  yyerror (YY_("memory exhausted"));
               ^
y.tab.c:241:22: note: expanded from macro 'YY_'
#  define YY_(msgid) msgid
                     ^
tglc.y:256:1: error: 'main' must return 'int'
void main(int argc, char **argv)
^~~~
int
4 warnings and 1 error generated.
<builtin>: recipe for target 'y.tab.o' failed
make: *** [y.tab.o] Error 1
----
tglc.y
void main(int argc, char **argv)

int main(int argc, char **argv)



add
  return TRUE;
---
 make
yacc -d -v tglc.y
g++   -I/usr/local/opt/llvm/include:/opt/X11/include  -c -o y.tab.o y.tab.c
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
tglc.y:88:15: warning: 12 enumeration values not handled in switch: 'Cnot', 'Cmodulo', 'Cand'...
      [-Wswitch]
    { switch ((yyvsp[(2) - (3)].op))  {
              ^
tglc.y:92:15: warning: 11 enumeration values not handled in switch: 'Cnot', 'Cand', 'Cadd'...
      [-Wswitch]
    { switch ((yyvsp[(2) - (3)].op))  {
              ^
y.tab.c:1822:20: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
      yyerror (YY_("syntax error"));
                   ^
y.tab.c:241:22: note: expanded from macro 'YY_'
#  define YY_(msgid) msgid
                     ^
y.tab.c:1968:16: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
  yyerror (YY_("memory exhausted"));
               ^
y.tab.c:241:22: note: expanded from macro 'YY_'
#  define YY_(msgid) msgid
                     ^
tglc.y:292:10: error: use of undeclared identifier 'TRUE'
  return TRUE;
         ^
4 warnings and 1 error generated.
---
tglc.y
return TRUE;

 return argc;
---
 make
yacc -d -v tglc.y
g++   -I/usr/local/opt/llvm/include:/opt/X11/include  -c -o y.tab.o y.tab.c
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
tglc.y:88:15: warning: 12 enumeration values not handled in switch: 'Cnot', 'Cmodulo', 'Cand'...
      [-Wswitch]
    { switch ((yyvsp[(2) - (3)].op))  {
              ^
tglc.y:92:15: warning: 11 enumeration values not handled in switch: 'Cnot', 'Cand', 'Cadd'...
      [-Wswitch]
    { switch ((yyvsp[(2) - (3)].op))  {
              ^
y.tab.c:1822:20: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
      yyerror (YY_("syntax error"));
                   ^
y.tab.c:241:22: note: expanded from macro 'YY_'
#  define YY_(msgid) msgid
                     ^
y.tab.c:1968:16: warning: conversion from string literal to 'char *' is deprecated
      [-Wc++11-compat-deprecated-writable-strings]
  yyerror (YY_("memory exhausted"));
               ^
y.tab.c:241:22: note: expanded from macro 'YY_'
#  define YY_(msgid) msgid
                     ^
4 warnings generated.
flex tglc.lex
tglc.lex:10: bad character: #
tglc.lex:10: unknown error processing section 1
tglc.lex:10: unknown error processing section 1
tglc.lex:10: bad character: <
tglc.lex:10: unknown error processing section 1
tglc.lex:10: bad character: >
Makefile:13: recipe for target 'lex.yy.c' failed
make: *** [lex.yy.c] Error 1
---
 
06:17 | 投票する | 投票数(0) | コメント(0)