swoole / yasd

Yet Another Swoole Debugger
https://huanghantao.github.io/yasd-wiki/
Apache License 2.0
357 stars 35 forks source link

Fix building warnings #162

Closed dmitryuk closed 2 years ago

dmitryuk commented 2 years ago

While building yasd where are a lot of warnings:

/tmp/yasd/yasd.cc:226:9: warning: variable 'start_lineno' set but not used [-Wunused-but-set-variable]
  226 |     int start_lineno;
      |     ^~~~~~~~~~~~~~~~~~~~~~~
/tmp/yasd/yasd.cc:340:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
  340 |     "Yasd",
      |     ^~~~~~
In file included from /tmp/yasd/yasd.cc:33:
/tmp/yasd/./php_yasd.h:29:26: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
   29 | #define PHP_YASD_VERSION "0.3.9-alpha"
      |                          ^~~~~~~~~~~~~
/tmp/yasd/yasd.cc:341:5: note: in expansion of macro 'PHP_YASD_VERSION'
  341 |     PHP_YASD_VERSION,
      |     ^~~~~~~~~~~~~~~~
/tmp/yasd/yasd.cc:342:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
  342 |     "codinghuang",
      |     ^~~~~~~~~~~~~
/tmp/yasd/yasd.cc:343:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
  343 |     "https://github.com/huanghantao",
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/yasd/yasd.cc:344:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
  344 |     "Our Copyright",
      |     ^~~~~~~~~~~~~~~

The PR fixes them

huanghantao commented 2 years ago

Thank you for your pr, but I think it is a question of php-src, I had already feedback at 6462

dmitryuk commented 2 years ago

This warnings are happening while swoole yasd compiling, not swoole-src

dmitryuk commented 2 years ago

Added fixes for

/home/runner/work/yasd/yasd/src/dbgp.cc:232:16: warning: variable ‘num’ set but not used [-Wunused-but-set-variable]
  232 |     zend_ulong num;
/home/runner/work/yasd/yasd/src/debuger_mode_base.cc:31:31: warning: comparison of integer expressions of different signedness: ‘const uint32_t’ {aka ‘const unsigned int’} and ‘int’ [-Wsign-compare]
   31 |     if (frame->opline->lineno == func_line_end && context->level != 1) {
      |         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/home/runner/work/yasd/yasd/src/debuger_mode_base.cc:33:38: warning: comparison of integer expressions of different signedness: ‘const uint32_t’ {aka ‘const unsigned int’} and ‘int’ [-Wsign-compare]
   33 |     } else if (frame->opline->lineno == func_line_end && context->level == 1) {
dmitryuk commented 2 years ago

Fixes

/home/runner/work/yasd/yasd/src/cmder_debugger.cc: In member function ‘virtual void yasd::CmderDebugger::init()’:
/home/runner/work/yasd/yasd/src/cmder_debugger.cc:51:21: warning: ‘status’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   51 |     } while (status != yasd::DebuggerModeBase::status::NEXT_OPLINE);
      |              ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/yasd/yasd/src/cmder_debugger.cc: In member function ‘virtual void yasd::CmderDebugger::handle_request(const char*, int)’:
/home/runner/work/yasd/yasd/src/cmder_debugger.cc:82:21: warning: ‘status’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   82 |     } while (status != yasd::DebuggerModeBase::status::NEXT_OPLINE);
dmitryuk commented 2 years ago
/home/runner/work/yasd/yasd/src/logger.cc:48:17: warning: variable ‘level_str’ set but not used [-Wunused-but-set-variable]
   48 |     const char *level_str;
/home/runner/work/yasd/yasd/yasd.cc:223:20: warning: unused variable ‘online’ [-Wunused-variable]
  223 |     const zend_op *online = EG(current_execute_data)->opline;
/home/runner/work/yasd/yasd/yasd.cc: In function ‘void yasd_statement_call(zend_execute_data*)’:
/home/runner/work/yasd/yasd/yasd.cc:238:48: warning: ‘lineno’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  238 |         return global->debugger->handle_request(filename, lineno);
/home/runner/work/yasd/yasd/src/cmder_debugger.cc:381:20: warning: unused variable ‘func’ [-Wunused-variable]
  381 |     zend_function *func = EG(current_execute_data)->func;
dmitryuk commented 2 years ago

Drop ubuntu 16-04 https://github.blog/changelog/2021-04-29-github-actions-ubuntu-16-04-lts-virtual-environment-will-be-removed-on-september-20-2021/

dmitryuk commented 2 years ago

@huanghantao Ready for review

dmitryuk commented 2 years ago

Any chance to review PR?