{"action":"created","issue":{"url":"https://api.github.com/repos/westes/flex/issues/403","repository_url":"https://api.github.com/repos/westes/flex","labels_url":"https://api.github.com/repos/westes/flex/issues/403/labels{/name}","comments_url":"https://api.github.com/repos/westes/flex/issues/403/comments","events_url":"https://api.github.com/repos/westes/flex/issues/403/events","html_url":"https://github.com/westes/flex/issues/403","id":379201583,"node_id":"MDU6SXNzdWUzNzkyMDE1ODM=","number":403,"title":"yy_init in c++ mode","user":{"login":"oneptr","id":42283604,"node_id":"MDQ6VXNlcjQyMjgzNjA0","avatar_url":"https://avatars2.githubusercontent.com/u/42283604?v=4","gravatar_id":"","url":"https://api.github.com/users/oneptr","html_url":"https://github.com/oneptr","followers_url":"https://api.github.com/users/oneptr/followers","following_url":"https://api.github.com/users/oneptr/following{/other_user}","gists_url":"https://api.github.com/users/oneptr/gists{/gist_id}","starred_url":"https://api.github.com/users/oneptr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oneptr/subscriptions","organizations_url":"https://api.github.com/users/oneptr/orgs","repos_url":"https://api.github.com/users/oneptr/repos","events_url":"https://api.github.com/users/oneptr/events{/privacy}","received_events_url":"https://api.github.com/users/oneptr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-09T15:16:26Z","updated_at":"2018-11-09T15:31:06Z","closed_at":null,"author_association":"NONE","body":"In the generated lexer the variable yy_init is not defined, when %option c++ is given, or when the lexer is generated with the -+ cli option. When that generated lexer is compiled, the compiler rightfully complains about yy_init used, but not declared/defined.\r\n\r\nflex version 2.6.4, linux system\r\n\r\nmore details:\r\n\r\n```\r\n> flex -o lexer.cc src/mkninja.lex      \r\n> cat lexer.cc | grep --color -n yy_init\r\n337:static int yy_init = 0;\t\t/* whether we need to initialize */\r\n358:static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file  );\r\n582:static int yy_init_globals ( void );\r\n800:\tif ( !(yy_init) )\r\n802:\t\t(yy_init) = 1;\r\n1461:\tyy_init_buffer( YY_CURRENT_BUFFER, input_file );\r\n1552:\tyy_init_buffer( b, file );\r\n1588:    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )\r\n1605:    /* If b is the current buffer, then yy_init_buffer was _probably_\r\n1989:static int yy_init_globals (void)\r\n1999:    (yy_init) = 0;\r\n2036:    yy_init_globals( );\r\n                                                                                                                                                                                                                                                                                                                \r\n> flex -+ -o lexer.cc src/mkninja.lex   \r\n > cat lexer.cc | grep --color -n yy_init\r\n659:\tif ( !(yy_init) )\r\n661:\t\t(yy_init) = 1;\r\n1018:\tyy_init = 0;\r\n1472:\tyy_init_buffer( YY_CURRENT_BUFFER, input_file );\r\n1575:\tyy_init_buffer( b, file );\r\n1623:    void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream& file )\r\n1638:    /* If b is the current buffer, then yy_init_buffer was _probably_\r\n\r\ng++ -std=c++17 -MMD -I src -I tmp -g -ggdb3 -MF obj/lexer.o.d -c lexer.cc -o obj/lexer.o\r\ntmp/lexer.cc: In function ‘yy::parser::symbol_type yylex(driver&)’:\r\ntmp/lexer.cc:659:9: error: ‘yy_init’ was not declared in this scope\r\n  if ( !(yy_init) )\r\n         ^~~~~~~\r\n\r\n                                                                                                                     \r\n```                                                                                                                                                                                           \r\n"},"comment":{"url":"https://api.github.com/repos/westes/flex/issues/comments/437395049","html_url":"https://github.com/westes/flex/issues/403#issuecomment-437395049","issue_url":"https://api.github.com/repos/westes/flex/issues/403","id":437395049,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzM5NTA0OQ==","user":{"login":"oneptr","id":42283604,"node_id":"MDQ6VXNlcjQyMjgzNjA0","avatar_url":"https://avatars2.githubusercontent.com/u/42283604?v=4","gravatar_id":"","url":"https://api.github.com/users/oneptr","html_url":"https://github.com/oneptr","followers_url":"https://api.github.com/users/oneptr/followers","following_url":"https://api.github.com/users/oneptr/following{/other_user}","gists_url":"https://api.github.com/users/oneptr/gists{/gist_id}","starred_url":"https://api.github.com/users/oneptr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oneptr/subscriptions","organizations_url":"https://api.github.com/users/oneptr/orgs","repos_url":"https://api.github.com/users/oneptr/repos","events_url":"https://api.github.com/users/oneptr/events{/privacy}","received_events_url":"https://api.github.com/users/oneptr/received_events","type":"User","site_admin":false},"created_at":"2018-11-09T15:31:06Z","updated_at":"2018-11-09T15:31:06Z","author_association":"NONE","body":"I just found out that if I omit the -+ option, therefore running in C mode, the C++ compiler is happy with the generated code.\r\nIt seems for now that the work around is to simply omit the -+ or % option c++.\r\n\r\n... weird...\r\n"}}
{"actor":{"display_login":"oneptr"}}