tags:

views:

406

answers:

1

I would like to know whether I am missing something:

//this is test.idl
typedef foo foo_t;
// end of test.idl

When I compile test.idl with the following command:

midl /W4 test.idl

I get this output

Microsoft (R) 32b/64b MIDL Compiler Version 6.00.0366
Copyright (c) Microsoft Corporation 1991-2002. All rights reserved.
Processing .\test.idl
test.idl

and I get a wrong test.h (at the bottom of this message) which has only

typedef foo_t;

where the unknown foo type was silently discarded.

I would have expected an error message stating "foo is an unknown type", am I wrong?

Do I need to pass any particular arguments to the MIDL command?

I got the same result with MIDL compiler version 7.00.0500

/* this ALWAYS GENERATED file contains the definitions for the
interfaces */

 /* File created by MIDL compiler version 6.00.0366 */
/* at Thu Nov 13 11:47:40 2008
 */
/* Compiler settings for test.idl:
    Oicf, W4, Zp8, env=Win32 (32b run)
    protocol : dce , ms_ext, c_ext, robust
    error checks: allocation ref bounds_check enum stub_data
    VC __declspec() decoration level:
         __declspec(uuid()), __declspec(selectany), __declspec
(novtable)
         DECLSPEC_UUID(), MIDL_INTERFACE()
*/
//@@MIDL_FILE_HEADING(  )

#pragma warning( disable: 4049 )  /* more than 64k source lines */

/* verify that the <rpcndr.h> version is high enough to compile this
file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 475
#endif

#include "rpc.h"
#include "rpcndr.h"

#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__

#ifndef __test_h__
#define __test_h__

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

/* Forward Declarations */

#ifdef __cplusplus
extern "C"{
#endif

void * __RPC_USER MIDL_user_allocate(size_t);
void __RPC_USER MIDL_user_free( void * );

/* interface __MIDL_itf_test_0000 */
/* [local] */

typedef foo_t;

extern RPC_IF_HANDLE __MIDL_itf_test_0000_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_test_0000_v0_0_s_ifspec;

/* Additional Prototypes for ALL interfaces */

/* end of Additional Prototypes */

#ifdef __cplusplus
}

#endif

#endif
A: 

I submitted the following bug to Microsoft:

MIDL does not report an error if a typedef uses an unknown type

uvts_cvs