Andes Workshop http://forum.andestech.com/ |
|
FlexeLint檢查會被最佳化的略去的loop http://forum.andestech.com/viewtopic.php?f=25&t=665 |
Page 1 of 1 |
Author: | cindy [ Thu Jan 24, 2013 6:07 pm ] |
Post subject: | FlexeLint檢查會被最佳化的略去的loop |
這一篇只是要告訴大家Lint tool的作用, Lint是一個程式的靜態分析軟體。 static analysis tools http://en.wikipedia.org/wiki/List_of_to ... .2FC.2B.2B ----------------------------------------------------------- 有加 volatile 的 delay loop 通過 FlexeLint 的檢查。 沒有 volatile 的 delay loop 會有警告訊息: Warning 522: Highest operation, function 'delay', lacks side-effects ======== FlexeLint for C/C++ (Unix) Vers. 9.00i, Copyright Gimpel Software 1985-2012 --- Module: delay.c (C) delay.c #include <stdio.h> #define TICK 10000000 void delay(int sum) { volatile int j; volatile int k; for(j = 0; j < sum; j++) { for(k = 0; k < TICK; k++) { } } } int main() { int i; printf("Hello\n"); for(i = 0; i < 5; i++) { printf("Go %d\n", i); delay(10); } } flint.sh delay.c FlexeLint for C/C++ (Unix) Vers. 9.00i, Copyright Gimpel Software 1985-2012 --- Module: delay.c (C) _ delay(10); delay.c 25 Warning 522: Highest operation, function 'delay', lacks side-effects delay.c // volatile int j; // volatile int k; int j; int k; |
Page 1 of 1 | All times are UTC + 8 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |