zoukankan      html  css  js  c++  java
  • 编译提示:warning: ISO C89 forbids mixed declarations and code

    在编译CSR8670程序的过程中,出现如下提示:

    Running 'C:/ADK3.5/tools/bin/make -R BLUELAB=C:/ADK3.5/tools -f part2.release.mak C:/Users/fingertouch/Desktop/part2/main.o'...
    Chip detected is gordon, default execution mode for this hardware is assisted
    C:/ADK3.5/tools/bin/xap-local-xap-gcc-3.3.3 -BC:/ADK3.5/tools/lib/gcc-lib/xap-local-xap-assisted/3.3.3\ -mpu -mleaf-optim -mno-function-sizeof -mworkaround-b96516 -g -O -fno-builtin-memcpy -ansi -pedantic -Wall -Wmissing-prototypes -Wstrict-prototypes -Wsign-compare -Wredundant-decls -Werror -IC:/ADK3.5/tools/include/firmware -IC:/ADK3.5/tools/include/standard -IC:/ADK3.5/tools/include/profiles/BlueLab-6.5.2-Release -Wp,-MD,C:/Users/fingertouch/Desktop/part2/depend/main -Wp,-MQ,C:/Users/fingertouch/Desktop/part2/main.o  -I./ -c C:/Users/fingertouch/Desktop/part2/main.c -o C:/Users/fingertouch/Desktop/part2/main.o
    C:/Users/fingertouch/Desktop/part2/main.c: In function `profile_handler':
    C:/Users/fingertouch/Desktop/part2/main.c:46: warning: ISO C89 forbids mixed declarations and code
    make: *** [C:/Users/fingertouch/Desktop/part2/main.o] Error 1
    Finished.
    

    在网上查了一下,发现是变量没有定义在程序块的开始位置导致的,调整一下程序语句,提示消失。

    原程序语句:

    static void profile_handler(Task task, MessageId id, Message message)
    {
        switch(id)
        {
            case CL_INIT_CFM:
            {
                DEBUG(("CL_INIT_CFM
    "));
                
                CL_INIT_CFM_T *msg = (CL_INIT_CFM_T*)message;
                
                if(msg->status == success)
                {
                    CsrInternalCodecTaskData *codec = PanicUnlessMalloc(sizeof(CsrInternalCodecTaskData));
                    CodecInitCsrInternal(codec, &simple_ag.task);
                    AghfpInit ( &simple_ag.task, aghfp_handsfree_15_profile, aghfp_incoming_call_reject | aghfp_inband_ring);  
                }
                else
                {
                    DEBUG((" CL_INIT_CFM failure : %d
    ", msg->status));
                    Panic();
                }
                break;
            }
        }
    }
    

    调整后:

    static void profile_handler(Task task, MessageId id, Message message)
    {
        switch(id)
        {
            case CL_INIT_CFM:
            {
                CL_INIT_CFM_T *msg = (CL_INIT_CFM_T*)message;
                DEBUG(("CL_INIT_CFM
    "));
                
                if(msg->status == success)
                {
                    CsrInternalCodecTaskData *codec = PanicUnlessMalloc(sizeof(CsrInternalCodecTaskData));
                    CodecInitCsrInternal(codec, &simple_ag.task);
                    AghfpInit ( &simple_ag.task, aghfp_handsfree_15_profile, aghfp_incoming_call_reject | aghfp_inband_ring);  
                }
                else
                {
                    DEBUG((" CL_INIT_CFM failure : %d
    ", msg->status));
                    Panic();
                }
                break;
            }
        }
    }
    

      

  • 相关阅读:
    saltstack总结-2018-0620
    我的书籍《Redis 源码日志》
    深入剖析 redis 主从复制
    深入剖析 redis AOF 持久化策略
    初探单点登录 SSO
    深入剖析 redis RDB 持久化策略
    深入剖析 redis 事件驱动
    memcached 源码阅读笔记
    Django 源码小剖: Django ORM 查询管理器
    Django 源码小剖: Django 对象关系映射(ORM)
  • 原文地址:https://www.cnblogs.com/fingertouch/p/4587958.html
Copyright © 2011-2022 走看看