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;
            }
        }
    }
    

      

  • 相关阅读:
    使用 DataAdapter 执行批量更新 [摘自MSDN]
    深入浅出net泛型编程
    模版页中引用文件路径的问题
    查询SQLSERVER某个表所占用空间大小的SQL语句
    如何获取SQL Server数据库里表的占用容量大小的存储过程
    确定计算机是否可以运行 Windows Vista? 操作系统
    SQL语句 [转]
    SQLServer中如何将一个字段的多个记录值合在一行显示
    ASP.net在页面所有内容生成后、输出内容前对页面内容进行操作
    oracle 删除用于及其表空间
  • 原文地址:https://www.cnblogs.com/fingertouch/p/4587958.html
Copyright © 2011-2022 走看看